Skip to content

Commit cf6e4c0

Browse files
Update IAM v3 documentation for Principal Access Boundary Policies, and Policy Bindings. (#13072) (#21684)
[upstream:d6528c7710ab14a25df1989d52937c029d6ad909] Signed-off-by: Modular Magician <magic-modules@google.com>
1 parent ef9f937 commit cf6e4c0

12 files changed

+117
-57
lines changed

.changelog/13072.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
```release-note: none
2+
```

google/services/iam3/resource_iam_folders_policy_binding.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,10 @@ func ResourceIAM3FoldersPolicyBinding() *schema.Resource {
9191
Type: schema.TypeString,
9292
Optional: true,
9393
ForceNew: true,
94-
Description: `Required. Immutable. The resource name of the policy to be bound.
95-
The binding parent and policy must belong to the same Organization (or Project).`,
94+
Description: `Required. Immutable. Full Resource Name of the principal set used for principal access boundary policy bindings.
95+
Examples for each one of the following supported principal set types:
96+
* Folder: '//cloudresourcemanager.googleapis.com/folders/FOLDER_ID'
97+
It must be parent by the policy binding's parent (the folder).`,
9698
},
9799
},
98100
},

google/services/iam3/resource_iam_folders_policy_binding_generated_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestAccIAM3FoldersPolicyBinding_iamFoldersPolicyBindingExample(t *testing.T
5151
Config: testAccIAM3FoldersPolicyBinding_iamFoldersPolicyBindingExample(context),
5252
},
5353
{
54-
ResourceName: "google_iam_folders_policy_binding.my-folder-binding",
54+
ResourceName: "google_iam_folders_policy_binding.binding-for-all-folder-principals",
5555
ImportState: true,
5656
ImportStateVerify: true,
5757
ImportStateVerifyIgnore: []string{"annotations", "folder", "location", "policy_binding_id"},
@@ -65,12 +65,12 @@ func testAccIAM3FoldersPolicyBinding_iamFoldersPolicyBindingExample(context map[
6565
resource "google_iam_principal_access_boundary_policy" "pab_policy" {
6666
organization = "%{org_id}"
6767
location = "global"
68-
display_name = "test folder binding%{random_suffix}"
68+
display_name = "binding for all principals in the folder%{random_suffix}"
6969
principal_access_boundary_policy_id = "tf-test-my-pab-policy%{random_suffix}"
7070
}
7171
7272
resource "google_folder" "folder" {
73-
display_name = "test folder%{random_suffix}"
73+
display_name = "my folder%{random_suffix}"
7474
parent = "organizations/%{org_id}"
7575
deletion_protection = false
7676
}
@@ -80,12 +80,12 @@ resource "time_sleep" "wait_120s" {
8080
create_duration = "120s"
8181
}
8282
83-
resource "google_iam_folders_policy_binding" "my-folder-binding" {
83+
resource "google_iam_folders_policy_binding" "binding-for-all-folder-principals" {
8484
folder = google_folder.folder.folder_id
8585
location = "global"
86-
display_name = "test folder binding%{random_suffix}"
86+
display_name = "binding for all principals in the folder%{random_suffix}"
8787
policy_kind = "PRINCIPAL_ACCESS_BOUNDARY"
88-
policy_binding_id = "tf-test-test-folder-binding%{random_suffix}"
88+
policy_binding_id = "tf-test-binding-for-all-folder-principals%{random_suffix}"
8989
policy = "organizations/%{org_id}/locations/global/principalAccessBoundaryPolicies/${google_iam_principal_access_boundary_policy.pab_policy.principal_access_boundary_policy_id}"
9090
target {
9191
principal_set = "//cloudresourcemanager.googleapis.com/folders/${google_folder.folder.folder_id}"

google/services/iam3/resource_iam_organizations_policy_binding.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,12 @@ func ResourceIAM3OrganizationsPolicyBinding() *schema.Resource {
9191
Type: schema.TypeString,
9292
Optional: true,
9393
ForceNew: true,
94-
Description: `Required. Immutable. The resource name of the policy to be bound.
95-
The binding parent and policy must belong to the same Organization (or Project).`,
94+
Description: `Required. Immutable. Full Resource Name of the principal set used for principal access boundary policy bindings.
95+
Examples for each one of the following supported principal set types:
96+
* Organization '//cloudresourcemanager.googleapis.com/organizations/ORGANIZATION_ID'
97+
* Workforce Identity: '//iam.googleapis.com/locations/global/workforcePools/WORKFORCE_POOL_ID'
98+
* Workspace Identity: '//iam.googleapis.com/locations/global/workspace/WORKSPACE_ID'
99+
It must be parent by the policy binding's parent (the organization).`,
96100
},
97101
},
98102
},

google/services/iam3/resource_iam_organizations_policy_binding_generated_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestAccIAM3OrganizationsPolicyBinding_iamOrganizationsPolicyBindingExample(
5151
Config: testAccIAM3OrganizationsPolicyBinding_iamOrganizationsPolicyBindingExample(context),
5252
},
5353
{
54-
ResourceName: "google_iam_organizations_policy_binding.my-org-binding",
54+
ResourceName: "google_iam_organizations_policy_binding.binding-for-all-org-principals",
5555
ImportState: true,
5656
ImportStateVerify: true,
5757
ImportStateVerifyIgnore: []string{"annotations", "location", "organization", "policy_binding_id"},
@@ -65,7 +65,7 @@ func testAccIAM3OrganizationsPolicyBinding_iamOrganizationsPolicyBindingExample(
6565
resource "google_iam_principal_access_boundary_policy" "pab_policy" {
6666
organization = "%{org_id}"
6767
location = "global"
68-
display_name = "test org binding%{random_suffix}"
68+
display_name = "binding for all principals in the Organization%{random_suffix}"
6969
principal_access_boundary_policy_id = "tf-test-my-pab-policy%{random_suffix}"
7070
}
7171
@@ -74,13 +74,13 @@ resource "time_sleep" "wait_60_seconds" {
7474
depends_on = [google_iam_principal_access_boundary_policy.pab_policy]
7575
}
7676
77-
resource "google_iam_organizations_policy_binding" "my-org-binding" {
77+
resource "google_iam_organizations_policy_binding" "binding-for-all-org-principals" {
7878
depends_on = [time_sleep.wait_60_seconds]
7979
organization = "%{org_id}"
8080
location = "global"
81-
display_name = "test org binding%{random_suffix}"
81+
display_name = "binding for all principals in the Organization%{random_suffix}"
8282
policy_kind = "PRINCIPAL_ACCESS_BOUNDARY"
83-
policy_binding_id = "tf-test-test-org-binding%{random_suffix}"
83+
policy_binding_id = "tf-test-binding-for-all-org-principals%{random_suffix}"
8484
policy = "organizations/%{org_id}/locations/global/principalAccessBoundaryPolicies/${google_iam_principal_access_boundary_policy.pab_policy.principal_access_boundary_policy_id}"
8585
target {
8686
principal_set = "//cloudresourcemanager.googleapis.com/organizations/%{org_id}"

google/services/iam3/resource_iam_principal_access_boundary_policy_generated_test.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,16 @@ func TestAccIAM3PrincipalAccessBoundaryPolicy_iamPrincipalAccessBoundaryPolicyEx
4242
acctest.VcrTest(t, resource.TestCase{
4343
PreCheck: func() { acctest.AccTestPreCheck(t) },
4444
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
45-
CheckDestroy: testAccCheckIAM3PrincipalAccessBoundaryPolicyDestroyProducer(t),
45+
ExternalProviders: map[string]resource.ExternalProvider{
46+
"time": {},
47+
},
48+
CheckDestroy: testAccCheckIAM3PrincipalAccessBoundaryPolicyDestroyProducer(t),
4649
Steps: []resource.TestStep{
4750
{
4851
Config: testAccIAM3PrincipalAccessBoundaryPolicy_iamPrincipalAccessBoundaryPolicyExample(context),
4952
},
5053
{
51-
ResourceName: "google_iam_principal_access_boundary_policy.my-pab-policy",
54+
ResourceName: "google_iam_principal_access_boundary_policy.pab-policy-for-org",
5255
ImportState: true,
5356
ImportStateVerify: true,
5457
ImportStateVerifyIgnore: []string{"annotations", "location", "organization", "principal_access_boundary_policy_id"},
@@ -59,11 +62,11 @@ func TestAccIAM3PrincipalAccessBoundaryPolicy_iamPrincipalAccessBoundaryPolicyEx
5962

6063
func testAccIAM3PrincipalAccessBoundaryPolicy_iamPrincipalAccessBoundaryPolicyExample(context map[string]interface{}) string {
6164
return acctest.Nprintf(`
62-
resource "google_iam_principal_access_boundary_policy" "my-pab-policy" {
65+
resource "google_iam_principal_access_boundary_policy" "pab-policy-for-org" {
6366
organization = "%{org_id}"
6467
location = "global"
65-
display_name = "test pab policy%{random_suffix}"
66-
principal_access_boundary_policy_id = "tf-test-test-pab-policy%{random_suffix}"
68+
display_name = "PAB policy for Organization%{random_suffix}"
69+
principal_access_boundary_policy_id = "tf-test-pab-policy-for-org%{random_suffix}"
6770
}
6871
`, context)
6972
}

google/services/iam3/resource_iam_projects_policy_binding.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,13 @@ func ResourceIAM3ProjectsPolicyBinding() *schema.Resource {
8686
Type: schema.TypeString,
8787
Optional: true,
8888
ForceNew: true,
89-
Description: `Required. Immutable. The resource name of the policy to be bound.
90-
The binding parent and policy must belong to the same Organization (or Project).`,
89+
Description: `Required. Immutable. Full Resource Name of the principal set used for principal access boundary policy bindings.
90+
Examples for each one of the following supported principal set types:
91+
* Project:
92+
* '//cloudresourcemanager.googleapis.com/projects/PROJECT_NUMBER'
93+
* '//cloudresourcemanager.googleapis.com/projects/PROJECT_ID'
94+
* Workload Identity Pool: '//iam.googleapis.com/projects/PROJECT_NUMBER/locations/LOCATION/workloadIdentityPools/WORKLOAD_POOL_ID'
95+
It must be parent by the policy binding's parent (the project).`,
9196
},
9297
},
9398
},

google/services/iam3/resource_iam_projects_policy_binding_generated_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestAccIAM3ProjectsPolicyBinding_iamProjectsPolicyBindingExample(t *testing
5151
Config: testAccIAM3ProjectsPolicyBinding_iamProjectsPolicyBindingExample(context),
5252
},
5353
{
54-
ResourceName: "google_iam_projects_policy_binding.my-project-binding",
54+
ResourceName: "google_iam_projects_policy_binding.binding-for-all-project-principals",
5555
ImportState: true,
5656
ImportStateVerify: true,
5757
ImportStateVerifyIgnore: []string{"annotations", "location", "policy_binding_id"},
@@ -69,7 +69,7 @@ data "google_project" "project" {
6969
resource "google_iam_principal_access_boundary_policy" "pab_policy" {
7070
organization = "%{org_id}"
7171
location = "global"
72-
display_name = "test project binding%{random_suffix}"
72+
display_name = "binding for all principals in the project%{random_suffix}"
7373
principal_access_boundary_policy_id = "tf-test-my-pab-policy%{random_suffix}"
7474
}
7575
@@ -78,13 +78,13 @@ resource "time_sleep" "wait_60_seconds" {
7878
depends_on = [google_iam_principal_access_boundary_policy.pab_policy]
7979
}
8080
81-
resource "google_iam_projects_policy_binding" "my-project-binding" {
81+
resource "google_iam_projects_policy_binding" "binding-for-all-project-principals" {
8282
depends_on = [time_sleep.wait_60_seconds]
8383
project = data.google_project.project.project_id
8484
location = "global"
85-
display_name = "test project binding%{random_suffix}"
85+
display_name = "binding for all principals in the project%{random_suffix}"
8686
policy_kind = "PRINCIPAL_ACCESS_BOUNDARY"
87-
policy_binding_id = "tf-test-test-project-binding%{random_suffix}"
87+
policy_binding_id = "tf-test-binding-for-all-project-principals%{random_suffix}"
8888
policy = "organizations/%{org_id}/locations/global/principalAccessBoundaryPolicies/${google_iam_principal_access_boundary_policy.pab_policy.principal_access_boundary_policy_id}"
8989
target {
9090
principal_set = "//cloudresourcemanager.googleapis.com/projects/${data.google_project.project.project_id}"

website/docs/r/iam_folders_policy_binding.html.markdown

+11-9
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
# ----------------------------------------------------------------------------
1717
subcategory: "Cloud IAM"
1818
description: |-
19-
A policy binding to a folder
19+
A policy binding to a folder.
2020
---
2121

2222
# google_iam_folders_policy_binding
2323

24-
A policy binding to a folder
24+
A policy binding to a folder. This is a Terraform resource, and maps to a policy binding resource in GCP.
2525

2626

2727
To get more information about FoldersPolicyBinding, see:
@@ -37,12 +37,12 @@ To get more information about FoldersPolicyBinding, see:
3737
resource "google_iam_principal_access_boundary_policy" "pab_policy" {
3838
organization = "123456789"
3939
location = "global"
40-
display_name = "test folder binding"
40+
display_name = "binding for all principals in the folder"
4141
principal_access_boundary_policy_id = "my-pab-policy"
4242
}
4343
4444
resource "google_folder" "folder" {
45-
display_name = "test folder"
45+
display_name = "my folder"
4646
parent = "organizations/123456789"
4747
deletion_protection = false
4848
}
@@ -52,12 +52,12 @@ resource "time_sleep" "wait_120s" {
5252
create_duration = "120s"
5353
}
5454
55-
resource "google_iam_folders_policy_binding" "my-folder-binding" {
55+
resource "google_iam_folders_policy_binding" "binding-for-all-folder-principals" {
5656
folder = google_folder.folder.folder_id
5757
location = "global"
58-
display_name = "test folder binding"
58+
display_name = "binding for all principals in the folder"
5959
policy_kind = "PRINCIPAL_ACCESS_BOUNDARY"
60-
policy_binding_id = "test-folder-binding"
60+
policy_binding_id = "binding-for-all-folder-principals"
6161
policy = "organizations/123456789/locations/global/principalAccessBoundaryPolicies/${google_iam_principal_access_boundary_policy.pab_policy.principal_access_boundary_policy_id}"
6262
target {
6363
principal_set = "//cloudresourcemanager.googleapis.com/folders/${google_folder.folder.folder_id}"
@@ -97,8 +97,10 @@ The following arguments are supported:
9797

9898
* `principal_set` -
9999
(Optional)
100-
Required. Immutable. The resource name of the policy to be bound.
101-
The binding parent and policy must belong to the same Organization (or Project).
100+
Required. Immutable. Full Resource Name of the principal set used for principal access boundary policy bindings.
101+
Examples for each one of the following supported principal set types:
102+
* Folder: `//cloudresourcemanager.googleapis.com/folders/FOLDER_ID`
103+
It must be parent by the policy binding's parent (the folder).
102104

103105
- - -
104106

website/docs/r/iam_organizations_policy_binding.html.markdown

+12-8
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
# ----------------------------------------------------------------------------
1717
subcategory: "Cloud IAM"
1818
description: |-
19-
A policy binding to an organizations
19+
A policy binding to an organization.
2020
---
2121

2222
# google_iam_organizations_policy_binding
2323

24-
A policy binding to an organizations
24+
A policy binding to an organization. This is a Terraform resource, and maps to a policy binding resource in GCP.
2525

2626

2727
To get more information about OrganizationsPolicyBinding, see:
@@ -37,7 +37,7 @@ To get more information about OrganizationsPolicyBinding, see:
3737
resource "google_iam_principal_access_boundary_policy" "pab_policy" {
3838
organization = "123456789"
3939
location = "global"
40-
display_name = "test org binding"
40+
display_name = "binding for all principals in the Organization"
4141
principal_access_boundary_policy_id = "my-pab-policy"
4242
}
4343
@@ -46,13 +46,13 @@ resource "time_sleep" "wait_60_seconds" {
4646
depends_on = [google_iam_principal_access_boundary_policy.pab_policy]
4747
}
4848
49-
resource "google_iam_organizations_policy_binding" "my-org-binding" {
49+
resource "google_iam_organizations_policy_binding" "binding-for-all-org-principals" {
5050
depends_on = [time_sleep.wait_60_seconds]
5151
organization = "123456789"
5252
location = "global"
53-
display_name = "test org binding"
53+
display_name = "binding for all principals in the Organization"
5454
policy_kind = "PRINCIPAL_ACCESS_BOUNDARY"
55-
policy_binding_id = "test-org-binding"
55+
policy_binding_id = "binding-for-all-org-principals"
5656
policy = "organizations/123456789/locations/global/principalAccessBoundaryPolicies/${google_iam_principal_access_boundary_policy.pab_policy.principal_access_boundary_policy_id}"
5757
target {
5858
principal_set = "//cloudresourcemanager.googleapis.com/organizations/123456789"
@@ -91,8 +91,12 @@ The following arguments are supported:
9191

9292
* `principal_set` -
9393
(Optional)
94-
Required. Immutable. The resource name of the policy to be bound.
95-
The binding parent and policy must belong to the same Organization (or Project).
94+
Required. Immutable. Full Resource Name of the principal set used for principal access boundary policy bindings.
95+
Examples for each one of the following supported principal set types:
96+
* Organization `//cloudresourcemanager.googleapis.com/organizations/ORGANIZATION_ID`
97+
* Workforce Identity: `//iam.googleapis.com/locations/global/workforcePools/WORKFORCE_POOL_ID`
98+
* Workspace Identity: `//iam.googleapis.com/locations/global/workspace/WORKSPACE_ID`
99+
It must be parent by the policy binding's parent (the organization).
96100

97101
- - -
98102

website/docs/r/iam_principal_access_boundary_policy.html.markdown

+38-5
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@
1616
# ----------------------------------------------------------------------------
1717
subcategory: "Cloud IAM"
1818
description: |-
19-
An IAM Principal Access Boundary Policy resource
19+
An IAM Principal Access Boundary Policy resource.
2020
---
2121

2222
# google_iam_principal_access_boundary_policy
2323

24-
An IAM Principal Access Boundary Policy resource
24+
An IAM Principal Access Boundary Policy resource. This resource has no effect on accesses until is bound to a target through policy bindings.
25+
You can see further documentation on policy bindings in:
26+
- [Organizations](/providers/hashicorp/google/latest/docs/resources/iam_organizations_policy_binding)
27+
- [Folders](/providers/hashicorp/google/latest/docs/resources/iam_folders_policy_binding)
28+
- [Projects](/providers/hashicorp/google/latest/docs/resources/iam_projects_policy_binding)
2529

2630

2731
To get more information about PrincipalAccessBoundaryPolicy, see:
@@ -34,11 +38,40 @@ To get more information about PrincipalAccessBoundaryPolicy, see:
3438

3539

3640
```hcl
37-
resource "google_iam_principal_access_boundary_policy" "my-pab-policy" {
41+
resource "google_iam_principal_access_boundary_policy" "pab-policy-for-org" {
3842
organization = "123456789"
3943
location = "global"
40-
display_name = "test pab policy"
41-
principal_access_boundary_policy_id = "test-pab-policy"
44+
display_name = "PAB policy for Organization"
45+
principal_access_boundary_policy_id = "pab-policy-for-org"
46+
}
47+
```
48+
## Example Usage - Iam Organizations Policy Binding
49+
50+
51+
```hcl
52+
resource "google_iam_principal_access_boundary_policy" "pab_policy" {
53+
organization = "123456789"
54+
location = "global"
55+
display_name = "Binding for all principals in the Organization"
56+
principal_access_boundary_policy_id = "my-pab-policy"
57+
}
58+
59+
resource "time_sleep" "wait_60_seconds" {
60+
create_duration = "60s"
61+
depends_on = [google_iam_principal_access_boundary_policy.pab_policy]
62+
}
63+
64+
resource "google_iam_organizations_policy_binding" "my-pab-policy" {
65+
depends_on = [time_sleep.wait_60_seconds]
66+
organization = "123456789"
67+
location = "global"
68+
display_name = "Binding for all principals in the Organization"
69+
policy_kind = "PRINCIPAL_ACCESS_BOUNDARY"
70+
policy_binding_id = "binding-for-all-org-principals"
71+
policy = "organizations/123456789/locations/global/principalAccessBoundaryPolicies/${google_iam_principal_access_boundary_policy.pab_policy.principal_access_boundary_policy_id}"
72+
target {
73+
principal_set = "//cloudresourcemanager.googleapis.com/organizations/123456789"
74+
}
4275
}
4376
```
4477

0 commit comments

Comments
 (0)