Package com.pulumi.gcp.cloudfunctionsv2
Class FunctionIamBinding
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.gcp.cloudfunctionsv2.FunctionIamBinding
-
public class FunctionIamBinding extends com.pulumi.resources.CustomResource
Three different resources help you manage your IAM policy for Cloud Functions (2nd gen) function. Each of these resources serves a different use case: * `gcp.cloudfunctionsv2.FunctionIamPolicy`: Authoritative. Sets the IAM policy for the function and replaces any existing policy already attached. * `gcp.cloudfunctionsv2.FunctionIamBinding`: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the function are preserved. * `gcp.cloudfunctionsv2.FunctionIamMember`: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the function are preserved. A data source can be used to retrieve policy data in advent you do not need creation * `gcp.cloudfunctionsv2.FunctionIamPolicy`: Retrieves the IAM policy for the function > **Note:** `gcp.cloudfunctionsv2.FunctionIamPolicy` **cannot** be used in conjunction with `gcp.cloudfunctionsv2.FunctionIamBinding` and `gcp.cloudfunctionsv2.FunctionIamMember` or they will fight over what your policy should be. > **Note:** `gcp.cloudfunctionsv2.FunctionIamBinding` resources **can be** used in conjunction with `gcp.cloudfunctionsv2.FunctionIamMember` resources **only if** they do not grant privilege to the same role. ## google\_cloudfunctions2\_function\_iam\_policy ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.organizations.OrganizationsFunctions; import com.pulumi.gcp.organizations.inputs.GetIAMPolicyArgs; import com.pulumi.gcp.cloudfunctionsv2.FunctionIamPolicy; import com.pulumi.gcp.cloudfunctionsv2.FunctionIamPolicyArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { final var admin = OrganizationsFunctions.getIAMPolicy(GetIAMPolicyArgs.builder() .bindings(GetIAMPolicyBindingArgs.builder() .role("roles/viewer") .members("user:[email protected]") .build()) .build()); var policy = new FunctionIamPolicy("policy", FunctionIamPolicyArgs.builder() .project(google_cloudfunctions2_function.function().project()) .location(google_cloudfunctions2_function.function().location()) .cloudFunction(google_cloudfunctions2_function.function().name()) .policyData(admin.applyValue(getIAMPolicyResult -> getIAMPolicyResult.policyData())) .build()); } } ``` ## google\_cloudfunctions2\_function\_iam\_binding ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.cloudfunctionsv2.FunctionIamBinding; import com.pulumi.gcp.cloudfunctionsv2.FunctionIamBindingArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var binding = new FunctionIamBinding("binding", FunctionIamBindingArgs.builder() .project(google_cloudfunctions2_function.function().project()) .location(google_cloudfunctions2_function.function().location()) .cloudFunction(google_cloudfunctions2_function.function().name()) .role("roles/viewer") .members("user:[email protected]") .build()); } } ``` ## google\_cloudfunctions2\_function\_iam\_member ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.cloudfunctionsv2.FunctionIamMember; import com.pulumi.gcp.cloudfunctionsv2.FunctionIamMemberArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var member = new FunctionIamMember("member", FunctionIamMemberArgs.builder() .project(google_cloudfunctions2_function.function().project()) .location(google_cloudfunctions2_function.function().location()) .cloudFunction(google_cloudfunctions2_function.function().name()) .role("roles/viewer") .member("user:[email protected]") .build()); } } ``` ## Import For all import syntaxes, the "resource in question" can take any of the following forms* projects/{{project}}/locations/{{location}}/functions/{{cloud_function}} * {{project}}/{{location}}/{{cloud_function}} * {{location}}/{{cloud_function}} * {{cloud_function}} Any variables not passed in the import command will be taken from the provider configuration. Cloud Functions (2nd gen) function IAM resources can be imported using the resource identifiers, role, and member. IAM member imports use space-delimited identifiersthe resource in question, the role, and the member identity, e.g. ```sh $ pulumi import gcp:cloudfunctionsv2/functionIamBinding:FunctionIamBinding editor "projects/{{project}}/locations/{{location}}/functions/{{cloud_function}} roles/viewer user:[email protected]" ``` IAM binding imports use space-delimited identifiersthe resource in question and the role, e.g. ```sh $ pulumi import gcp:cloudfunctionsv2/functionIamBinding:FunctionIamBinding editor "projects/{{project}}/locations/{{location}}/functions/{{cloud_function}} roles/viewer" ``` IAM policy imports use the identifier of the resource in question, e.g. ```sh $ pulumi import gcp:cloudfunctionsv2/functionIamBinding:FunctionIamBinding editor projects/{{project}}/locations/{{location}}/functions/{{cloud_function}} ``` -> **Custom Roles**If you're importing a IAM resource with a custom role, make sure to use the full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
-
-
Constructor Summary
Constructors Constructor Description FunctionIamBinding(java.lang.String name)
FunctionIamBinding(java.lang.String name, FunctionIamBindingArgs args)
FunctionIamBinding(java.lang.String name, FunctionIamBindingArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>
cloudFunction()
com.pulumi.core.Output<java.util.Optional<FunctionIamBindingCondition>>
condition()
com.pulumi.core.Output<java.lang.String>
etag()
static FunctionIamBinding
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, FunctionIamBindingState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>
location()
com.pulumi.core.Output<java.util.List<java.lang.String>>
members()
com.pulumi.core.Output<java.lang.String>
project()
com.pulumi.core.Output<java.lang.String>
role()
-
-
-
Constructor Detail
-
FunctionIamBinding
public FunctionIamBinding(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
FunctionIamBinding
public FunctionIamBinding(java.lang.String name, FunctionIamBindingArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
FunctionIamBinding
public FunctionIamBinding(java.lang.String name, FunctionIamBindingArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
cloudFunction
public com.pulumi.core.Output<java.lang.String> cloudFunction()
- Returns:
- Used to find the parent resource to bind the IAM policy to
-
condition
public com.pulumi.core.Output<java.util.Optional<FunctionIamBindingCondition>> condition()
-
etag
public com.pulumi.core.Output<java.lang.String> etag()
- Returns:
- (Computed) The etag of the IAM policy.
-
location
public com.pulumi.core.Output<java.lang.String> location()
- Returns:
- The location of this cloud function. Used to find the parent resource to bind the IAM policy to
-
members
public com.pulumi.core.Output<java.util.List<java.lang.String>> members()
-
project
public com.pulumi.core.Output<java.lang.String> project()
- Returns:
- The ID of the project in which the resource belongs. If it is not provided, the project will be parsed from the identifier of the parent resource. If no project is provided in the parent identifier and no project is specified, the provider project is used. * `member/members` - (Required) Identities that will be granted the privilege in `role`. Each entry can have one of the following values: * **allUsers**: A special identifier that represents anyone who is on the internet; with or without a Google account. * **allAuthenticatedUsers**: A special identifier that represents anyone who is authenticated with a Google account or a service account. * **user:{emailid}**: An email address that represents a specific Google account. For example, [email protected] or [email protected]. * **serviceAccount:{emailid}**: An email address that represents a service account. For example, [email protected]. * **group:{emailid}**: An email address that represents a Google group. For example, [email protected]. * **domain:{domain}**: A G Suite domain (primary, instead of alias) name that represents all the users of that domain. For example, google.com or example.com. * **projectOwner:projectid**: Owners of the given project. For example, "projectOwner:my-example-project" * **projectEditor:projectid**: Editors of the given project. For example, "projectEditor:my-example-project" * **projectViewer:projectid**: Viewers of the given project. For example, "projectViewer:my-example-project"
-
role
public com.pulumi.core.Output<java.lang.String> role()
- Returns:
- The role that should be applied. Only one `gcp.cloudfunctionsv2.FunctionIamBinding` can be used per role. Note that custom roles must be of the format `[projects|organizations]/{parent-name}/roles/{role-name}`.
-
get
public static FunctionIamBinding get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable FunctionIamBindingState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-