1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. projects
  5. IamMemberRemove
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

gcp.projects.IamMemberRemove

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

    Ensures that a member:role pairing does not exist in a project’s IAM policy.

    On create, this resource will modify the policy to remove the member from the role. If the membership is ever re-added, the next refresh will clear this resource from state, proposing re-adding it to correct the membership. Import is not supported- this resource will acquire the current policy and modify it as part of creating the resource.

    This resource will conflict with gcp.projects.IAMPolicy and gcp.projects.IAMBinding resources that share a role, as well as gcp.projects.IAMMember resources that target the same membership. When multiple resources conflict the final state is not guaranteed to include or omit the membership. Subsequent pulumi up calls will always show a diff until the configuration is corrected.

    For more information see the official documentation and API reference.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const targetProject = gcp.organizations.getProject({});
    const foo = new gcp.projects.IamMemberRemove("foo", {
        role: "roles/editor",
        project: targetProjectGoogleProject.projectId,
        member: `serviceAccount:${targetProjectGoogleProject.number}-compute@developer.gserviceaccount.com`,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    target_project = gcp.organizations.get_project()
    foo = gcp.projects.IamMemberRemove("foo",
        role="roles/editor",
        project=target_project_google_project["projectId"],
        member=f"serviceAccount:{target_project_google_project['number']}-compute@developer.gserviceaccount.com")
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/projects"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = projects.NewIamMemberRemove(ctx, "foo", &projects.IamMemberRemoveArgs{
    			Role:    pulumi.String("roles/editor"),
    			Project: pulumi.Any(targetProjectGoogleProject.ProjectId),
    			Member:  pulumi.Sprintf("serviceAccount:%v-compute@developer.gserviceaccount.com", targetProjectGoogleProject.Number),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var targetProject = Gcp.Organizations.GetProject.Invoke();
    
        var foo = new Gcp.Projects.IamMemberRemove("foo", new()
        {
            Role = "roles/editor",
            Project = targetProjectGoogleProject.ProjectId,
            Member = $"serviceAccount:{targetProjectGoogleProject.Number}-compute@developer.gserviceaccount.com",
        });
    
    });
    
    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.GetProjectArgs;
    import com.pulumi.gcp.projects.IamMemberRemove;
    import com.pulumi.gcp.projects.IamMemberRemoveArgs;
    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 targetProject = OrganizationsFunctions.getProject();
    
            var foo = new IamMemberRemove("foo", IamMemberRemoveArgs.builder()
                .role("roles/editor")
                .project(targetProjectGoogleProject.projectId())
                .member(String.format("serviceAccount:%s-compute@developer.gserviceaccount.com", targetProjectGoogleProject.number()))
                .build());
    
        }
    }
    
    resources:
      foo:
        type: gcp:projects:IamMemberRemove
        properties:
          role: roles/editor
          project: ${targetProjectGoogleProject.projectId}
          member: serviceAccount:${targetProjectGoogleProject.number}-compute@developer.gserviceaccount.com
    variables:
      targetProject:
        fn::invoke:
          Function: gcp:organizations:getProject
          Arguments: {}
    

    Create IamMemberRemove Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new IamMemberRemove(name: string, args: IamMemberRemoveArgs, opts?: CustomResourceOptions);
    @overload
    def IamMemberRemove(resource_name: str,
                        args: IamMemberRemoveArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def IamMemberRemove(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        member: Optional[str] = None,
                        project: Optional[str] = None,
                        role: Optional[str] = None)
    func NewIamMemberRemove(ctx *Context, name string, args IamMemberRemoveArgs, opts ...ResourceOption) (*IamMemberRemove, error)
    public IamMemberRemove(string name, IamMemberRemoveArgs args, CustomResourceOptions? opts = null)
    public IamMemberRemove(String name, IamMemberRemoveArgs args)
    public IamMemberRemove(String name, IamMemberRemoveArgs args, CustomResourceOptions options)
    
    type: gcp:projects:IamMemberRemove
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args IamMemberRemoveArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args IamMemberRemoveArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args IamMemberRemoveArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args IamMemberRemoveArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args IamMemberRemoveArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var iamMemberRemoveResource = new Gcp.Projects.IamMemberRemove("iamMemberRemoveResource", new()
    {
        Member = "string",
        Project = "string",
        Role = "string",
    });
    
    example, err := projects.NewIamMemberRemove(ctx, "iamMemberRemoveResource", &projects.IamMemberRemoveArgs{
    	Member:  pulumi.String("string"),
    	Project: pulumi.String("string"),
    	Role:    pulumi.String("string"),
    })
    
    var iamMemberRemoveResource = new IamMemberRemove("iamMemberRemoveResource", IamMemberRemoveArgs.builder()
        .member("string")
        .project("string")
        .role("string")
        .build());
    
    iam_member_remove_resource = gcp.projects.IamMemberRemove("iamMemberRemoveResource",
        member="string",
        project="string",
        role="string")
    
    const iamMemberRemoveResource = new gcp.projects.IamMemberRemove("iamMemberRemoveResource", {
        member: "string",
        project: "string",
        role: "string",
    });
    
    type: gcp:projects:IamMemberRemove
    properties:
        member: string
        project: string
        role: string
    

    IamMemberRemove Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The IamMemberRemove resource accepts the following input properties:

    Member string
    The IAM principal that should not have the target role. Each entry can have one of the following values:

    • user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
    • serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
    • group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
    • 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.
    Project string
    The project id of the target project.
    Role string
    The target role that should be removed.
    Member string
    The IAM principal that should not have the target role. Each entry can have one of the following values:

    • user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
    • serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
    • group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
    • 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.
    Project string
    The project id of the target project.
    Role string
    The target role that should be removed.
    member String
    The IAM principal that should not have the target role. Each entry can have one of the following values:

    • user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
    • serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
    • group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
    • 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.
    project String
    The project id of the target project.
    role String
    The target role that should be removed.
    member string
    The IAM principal that should not have the target role. Each entry can have one of the following values:

    • user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
    • serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
    • group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
    • 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.
    project string
    The project id of the target project.
    role string
    The target role that should be removed.
    member str
    The IAM principal that should not have the target role. Each entry can have one of the following values:

    • user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
    • serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
    • group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
    • 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.
    project str
    The project id of the target project.
    role str
    The target role that should be removed.
    member String
    The IAM principal that should not have the target role. Each entry can have one of the following values:

    • user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
    • serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
    • group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
    • 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.
    project String
    The project id of the target project.
    role String
    The target role that should be removed.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the IamMemberRemove resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing IamMemberRemove Resource

    Get an existing IamMemberRemove resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: IamMemberRemoveState, opts?: CustomResourceOptions): IamMemberRemove
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            member: Optional[str] = None,
            project: Optional[str] = None,
            role: Optional[str] = None) -> IamMemberRemove
    func GetIamMemberRemove(ctx *Context, name string, id IDInput, state *IamMemberRemoveState, opts ...ResourceOption) (*IamMemberRemove, error)
    public static IamMemberRemove Get(string name, Input<string> id, IamMemberRemoveState? state, CustomResourceOptions? opts = null)
    public static IamMemberRemove get(String name, Output<String> id, IamMemberRemoveState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Member string
    The IAM principal that should not have the target role. Each entry can have one of the following values:

    • user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
    • serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
    • group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
    • 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.
    Project string
    The project id of the target project.
    Role string
    The target role that should be removed.
    Member string
    The IAM principal that should not have the target role. Each entry can have one of the following values:

    • user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
    • serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
    • group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
    • 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.
    Project string
    The project id of the target project.
    Role string
    The target role that should be removed.
    member String
    The IAM principal that should not have the target role. Each entry can have one of the following values:

    • user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
    • serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
    • group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
    • 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.
    project String
    The project id of the target project.
    role String
    The target role that should be removed.
    member string
    The IAM principal that should not have the target role. Each entry can have one of the following values:

    • user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
    • serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
    • group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
    • 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.
    project string
    The project id of the target project.
    role string
    The target role that should be removed.
    member str
    The IAM principal that should not have the target role. Each entry can have one of the following values:

    • user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
    • serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
    • group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
    • 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.
    project str
    The project id of the target project.
    role str
    The target role that should be removed.
    member String
    The IAM principal that should not have the target role. Each entry can have one of the following values:

    • user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
    • serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
    • group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
    • 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.
    project String
    The project id of the target project.
    role String
    The target role that should be removed.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi