IAMPartialPolicy
IAMPartialPolicy
lets you manage the IAM policy
bindings for a given Google Cloud resource.
IAMPartialPolicy
represents a non-authoritative intent for the
associated Google Cloud resource's IAM policy
bindings. Config Connector merges the bindings in the
IAMPartialPolicy
spec
with the bindings and audit configs
that already exist in the underlying IAM policy, and then
sets the merged result as the IAM policy for the
associated Google Cloud resource. If there are invalid roles or
members, the entire operation fails with errors.
To delete any existing bindings, first acquire the existing bindings by
applying an IAMPartialPolicy
that includes said bindings, then remove
said bindings from the IAMPartialPolicy
configuration and re-apply the
configuration.
If you want authoritative control over bindings, use IAMPolicy. If you want to manage the binding for only a single IAM member, use IAMPolicyMember.
Property | Value |
---|---|
Google Cloud Service Name | IAM |
Google Cloud Service Documentation | /iam/docs/ |
Google Cloud REST Resource Name | v1.iamPolicies |
Google Cloud REST Resource Documentation | /iam/reference/rest/v1/iamPolicies |
Config Connector Resource Short Names | gcpiampartialpolicy gcpiampartialpolicies iampartialpolicy |
Config Connector Service Name | iam.googleapis.com |
Config Connector Resource Fully Qualified Name | iampartialpolicies.iam.cnrm.cloud.google.com |
Can Be Referenced by IAMPolicy/IAMPolicyMember | No |
Config Connector Default Average Reconcile Interval In Seconds | 600 |
Supported Resources
You can use IAMPartialPolicy
to configure IAM for
the following resources.
Kind | Supports Conditions |
---|---|
AccessContextManagerAccessPolicy |
|
ApigeeEnvironment |
Y |
ArtifactRegistryRepository |
|
BigQueryTable |
Y |
BigtableInstance |
Y |
BigtableTable |
Y |
BillingAccount |
Y |
BinaryAuthorizationPolicy |
Y |
CloudFunctionsFunction |
Y |
ComputeBackendBucket |
|
ComputeDisk |
|
ComputeImage |
Y |
ComputeInstance |
Y |
ComputeSnapshot |
|
ComputeSubnetwork |
Y |
DNSManagedZone |
|
DataprocCluster |
Y |
Folder |
Y |
IAMServiceAccount |
Y |
IAMWorkforcePool |
Y |
KMSCryptoKey |
Y |
KMSKeyRing |
Y |
NetworkSecurityAuthorizationPolicy |
Y |
NetworkSecurityClientTLSPolicy |
Y |
NetworkSecurityServerTLSPolicy |
Y |
Organization |
Y |
Project |
Y |
PubSubSubscription |
|
PubSubTopic |
|
RunJob |
|
RunService |
|
SecretManagerSecret |
|
ServiceDirectoryNamespace |
|
ServiceDirectoryService |
|
SourceRepoRepository |
|
SpannerDatabase |
Y |
SpannerInstance |
|
StorageBucket |
Y |
Kind | External Reference Formats |
---|---|
AccessContextManagerAccessPolicy |
|
ApigeeEnvironment |
|
ArtifactRegistryRepository |
|
BigQueryTable |
|
BigtableInstance |
|
BigtableTable |
|
BillingAccount |
|
BinaryAuthorizationPolicy |
|
CloudFunctionsFunction |
|
ComputeBackendBucket |
|
ComputeDisk |
|
ComputeImage |
|
ComputeInstance |
|
ComputeSnapshot |
|
ComputeSubnetwork |
|
DNSManagedZone |
|
DataprocCluster |
|
Folder |
|
IAMServiceAccount |
|
IAMWorkforcePool |
|
KMSCryptoKey |
|
KMSKeyRing |
|
NetworkSecurityAuthorizationPolicy |
|
NetworkSecurityClientTLSPolicy |
|
NetworkSecurityServerTLSPolicy |
|
Organization |
|
Project |
|
PubSubSubscription |
|
PubSubTopic |
|
RunJob |
|
RunService |
|
SecretManagerSecret |
|
ServiceDirectoryNamespace |
|
ServiceDirectoryService |
|
SourceRepoRepository |
|
SpannerDatabase |
|
SpannerInstance |
|
StorageBucket |
|
Custom Resource Definition Properties
Spec
Schema
bindings:
- condition:
description: string
expression: string
title: string
members:
- member: string
memberFrom:
logSinkRef:
name: string
namespace: string
serviceAccountRef:
name: string
namespace: string
serviceIdentityRef:
name: string
namespace: string
sqlInstanceRef:
name: string
namespace: string
role: string
resourceRef:
apiVersion: string
external: string
kind: string
name: string
namespace: string
Fields | |
---|---|
Optional |
Optional. The list of IAM bindings managed by Config Connector. |
Optional |
Specifies the members to bind to an IAM role. |
Optional |
Optional. The condition under which the binding applies. |
Optional |
|
Required* |
|
Required* |
|
Optional |
Optional. The list of IAM users to be bound to the role. |
Optional |
|
Optional |
The IAM identity to be bound to the role. Exactly one of 'member' or 'memberFrom' must be used. |
Optional |
The IAM identity to be bound to the role. Exactly one of 'member' or 'memberFrom' must be used, and only one subfield within 'memberFrom' can be used. |
Optional |
The LoggingLogSink whose writer identity (i.e. its 'status.writerIdentity') is to be bound to the role. |
Required* |
|
Optional |
|
Optional |
The IAMServiceAccount to be bound to the role. |
Required* |
|
Optional |
|
Optional |
The ServiceIdentity whose service account (i.e., its 'status.email') is to be bound to the role. |
Required* |
|
Optional |
|
Optional |
The SQLInstance whose service account (i.e. its 'status.serviceAccountEmailAddress') is to be bound to the role. |
Required* |
|
Optional |
|
Required* |
Required. The role to bind the users to. |
Required* |
Immutable. Required. The GCP resource to set the IAM policy on. |
Optional |
|
Optional |
|
Required* |
|
Optional |
|
Optional |
|
* Field is required when parent field is specified
Status
Schema
allBindings:
- condition:
description: string
expression: string
title: string
members:
- string
role: string
conditions:
- lastTransitionTime: string
message: string
reason: string
status: string
type: string
lastAppliedBindings:
- condition:
description: string
expression: string
title: string
members:
- string
role: string
observedGeneration: integer
Fields | |
---|---|
allBindings |
AllBindings surfaces all IAM bindings for the referenced resource. |
allBindings[] |
Specifies the members to bind to an IAM role. |
allBindings[].condition |
Optional. The condition under which the binding applies. |
allBindings[].condition.description |
|
allBindings[].condition.expression |
|
allBindings[].condition.title |
|
allBindings[].members |
Optional. The list of IAM users to be bound to the role. |
allBindings[].members[] |
|
allBindings[].role |
Required. The role to bind the users to. |
conditions |
Conditions represent the latest available observations of the IAM policy's current state. |
conditions[] |
|
conditions[].lastTransitionTime |
Last time the condition transitioned from one status to another. |
conditions[].message |
Human-readable message indicating details about last transition. |
conditions[].reason |
Unique, one-word, CamelCase reason for the condition's last transition. |
conditions[].status |
Status is the status of the condition. Can be True, False, Unknown. |
conditions[].type |
Type is the type of the condition. |
lastAppliedBindings |
LastAppliedBindings is the list of IAM bindings that were most recently applied by Config Connector. |
lastAppliedBindings[] |
Specifies the members to bind to an IAM role. |
lastAppliedBindings[].condition |
Optional. The condition under which the binding applies. |
lastAppliedBindings[].condition.description |
|
lastAppliedBindings[].condition.expression |
|
lastAppliedBindings[].condition.title |
|
lastAppliedBindings[].members |
Optional. The list of IAM users to be bound to the role. |
lastAppliedBindings[].members[] |
|
lastAppliedBindings[].role |
Required. The role to bind the users to. |
observedGeneration |
ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource. |
Sample YAML(s)
Project Level Iampartialpolicy
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# **NOTE**: The policy here represents a non-authoritative declarative intent for the
# referenced project. It will merge with the existing bindings on the project.
apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMPartialPolicy
metadata:
name: iampartialpolicy-sample-project
spec:
resourceRef:
kind: Project
name: iampartialpolicy-dep-project
bindings:
- role: roles/storage.admin
members:
- member: serviceAccount:iampartialpolicy-dep-project@iampartialpolicy-dep-project.iam.gserviceaccount.com
- role: roles/editor
members:
- memberFrom:
serviceAccountRef:
name: iampartialpolicy-dep-project
---
apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMServiceAccount
metadata:
annotations:
cnrm.cloud.google.com/project-id: iampartialpolicy-dep-project
name: iampartialpolicy-dep-project
---
apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1
kind: Project
metadata:
annotations:
cnrm.cloud.google.com/auto-create-network: "false"
name: iampartialpolicy-dep-project
spec:
name: Config Connector Sample
organizationRef:
# Replace "${ORG_ID?}" with the numeric ID for your organization
external: "${ORG_ID?}"
PubSub Admin Iampartialpolicy
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Replace ${PROJECT_ID?} below with your desired project ID.
apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMPartialPolicy
metadata:
name: iampartialpolicy-sample-pubsubadmin
spec:
resourceRef:
kind: PubSubTopic
name: iampartialpolicy-dep-pubsubadmin
bindings:
- role: roles/editor
members:
- member: serviceAccount:partialpolicy-dep-pubsubadmin@${PROJECT_ID?}.iam.gserviceaccount.com
---
# Replace ${PROJECT_ID?} below with your desired project ID.
apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMServiceAccount
metadata:
annotations:
cnrm.cloud.google.com/project-id: ${PROJECT_ID?}
name: partialpolicy-dep-pubsubadmin
---
apiVersion: pubsub.cnrm.cloud.google.com/v1beta1
kind: PubSubTopic
metadata:
name: iampartialpolicy-dep-pubsubadmin