1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. projects
  5. IAMMember
Google Cloud Classic v6.57.0 published on Tuesday, May 30, 2023 by Pulumi

gcp.projects.IAMMember

Explore with Pulumi AI

gcp logo
Google Cloud Classic v6.57.0 published on Tuesday, May 30, 2023 by Pulumi

    Four different resources help you manage your IAM policy for a project. Each of these resources serves a different use case:

    • gcp.projects.IAMPolicy: Authoritative. Sets the IAM policy for the project and replaces any existing policy already attached.
    • gcp.projects.IAMBinding: 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 project are preserved.
    • gcp.projects.IAMMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the project are preserved.
    • gcp.projects.IAMAuditConfig: Authoritative for a given service. Updates the IAM policy to enable audit logging for the given service.

    Note: gcp.projects.IAMPolicy cannot be used in conjunction with gcp.projects.IAMBinding, gcp.projects.IAMMember, or gcp.projects.IAMAuditConfig or they will fight over what your policy should be.

    Note: gcp.projects.IAMBinding resources can be used in conjunction with gcp.projects.IAMMember resources only if they do not grant privilege to the same role.

    Note: The underlying API method projects.setIamPolicy has a lot of constraints which are documented here. In addition to these constraints, IAM Conditions cannot be used with Basic Roles such as Owner. Violating these constraints will result in the API returning 400 error code so please review these if you encounter errors with this resource.

    google_project_iam_policy

    !> Be careful! You can accidentally lock yourself out of your project using this resource. Deleting a gcp.projects.IAMPolicy removes access from anyone without organization-level access to the project. Proceed with caution. It’s not recommended to use gcp.projects.IAMPolicy with your provider project to avoid locking yourself out, and it should generally only be used with projects fully managed by this provider. If you do use this resource, it is recommended to import the policy before applying the change.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const admin = gcp.organizations.getIAMPolicy({
        bindings: [{
            role: "roles/editor",
            members: ["user:jane@example.com"],
        }],
    });
    const project = new gcp.projects.IAMPolicy("project", {
        project: "your-project-id",
        policyData: admin.then(admin => admin.policyData),
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    admin = gcp.organizations.get_iam_policy(bindings=[gcp.organizations.GetIAMPolicyBindingArgs(
        role="roles/editor",
        members=["user:jane@example.com"],
    )])
    project = gcp.projects.IAMPolicy("project",
        project="your-project-id",
        policy_data=admin.policy_data)
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var admin = Gcp.Organizations.GetIAMPolicy.Invoke(new()
        {
            Bindings = new[]
            {
                new Gcp.Organizations.Inputs.GetIAMPolicyBindingInputArgs
                {
                    Role = "roles/editor",
                    Members = new[]
                    {
                        "user:jane@example.com",
                    },
                },
            },
        });
    
        var project = new Gcp.Projects.IAMPolicy("project", new()
        {
            Project = "your-project-id",
            PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/projects"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		admin, err := organizations.LookupIAMPolicy(ctx, &organizations.LookupIAMPolicyArgs{
    			Bindings: []organizations.GetIAMPolicyBinding{
    				{
    					Role: "roles/editor",
    					Members: []string{
    						"user:jane@example.com",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = projects.NewIAMPolicy(ctx, "project", &projects.IAMPolicyArgs{
    			Project:    pulumi.String("your-project-id"),
    			PolicyData: *pulumi.String(admin.PolicyData),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.projects.IAMPolicy;
    import com.pulumi.gcp.projects.IAMPolicyArgs;
    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/editor")
                    .members("user:jane@example.com")
                    .build())
                .build());
    
            var project = new IAMPolicy("project", IAMPolicyArgs.builder()        
                .project("your-project-id")
                .policyData(admin.applyValue(getIAMPolicyResult -> getIAMPolicyResult.policyData()))
                .build());
    
        }
    }
    
    resources:
      project:
        type: gcp:projects:IAMPolicy
        properties:
          project: your-project-id
          policyData: ${admin.policyData}
    variables:
      admin:
        fn::invoke:
          Function: gcp:organizations:getIAMPolicy
          Arguments:
            bindings:
              - role: roles/editor
                members:
                  - user:jane@example.com
    

    With IAM Conditions:

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const admin = gcp.organizations.getIAMPolicy({
        bindings: [{
            condition: {
                description: "Expiring at midnight of 2019-12-31",
                expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
                title: "expires_after_2019_12_31",
            },
            members: ["user:jane@example.com"],
            role: "roles/compute.admin",
        }],
    });
    const project = new gcp.projects.IAMPolicy("project", {
        policyData: admin.then(admin => admin.policyData),
        project: "your-project-id",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    admin = gcp.organizations.get_iam_policy(bindings=[gcp.organizations.GetIAMPolicyBindingArgs(
        condition=gcp.organizations.GetIAMPolicyBindingConditionArgs(
            description="Expiring at midnight of 2019-12-31",
            expression="request.time < timestamp(\"2020-01-01T00:00:00Z\")",
            title="expires_after_2019_12_31",
        ),
        members=["user:jane@example.com"],
        role="roles/compute.admin",
    )])
    project = gcp.projects.IAMPolicy("project",
        policy_data=admin.policy_data,
        project="your-project-id")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var admin = Gcp.Organizations.GetIAMPolicy.Invoke(new()
        {
            Bindings = new[]
            {
                new Gcp.Organizations.Inputs.GetIAMPolicyBindingInputArgs
                {
                    Condition = new Gcp.Organizations.Inputs.GetIAMPolicyBindingConditionInputArgs
                    {
                        Description = "Expiring at midnight of 2019-12-31",
                        Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
                        Title = "expires_after_2019_12_31",
                    },
                    Members = new[]
                    {
                        "user:jane@example.com",
                    },
                    Role = "roles/compute.admin",
                },
            },
        });
    
        var project = new Gcp.Projects.IAMPolicy("project", new()
        {
            PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
            Project = "your-project-id",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/projects"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		admin, err := organizations.LookupIAMPolicy(ctx, &organizations.LookupIAMPolicyArgs{
    			Bindings: []organizations.GetIAMPolicyBinding{
    				{
    					Condition: {
    						Description: pulumi.StringRef("Expiring at midnight of 2019-12-31"),
    						Expression:  "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
    						Title:       "expires_after_2019_12_31",
    					},
    					Members: []string{
    						"user:jane@example.com",
    					},
    					Role: "roles/compute.admin",
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = projects.NewIAMPolicy(ctx, "project", &projects.IAMPolicyArgs{
    			PolicyData: *pulumi.String(admin.PolicyData),
    			Project:    pulumi.String("your-project-id"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.projects.IAMPolicy;
    import com.pulumi.gcp.projects.IAMPolicyArgs;
    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()
                    .condition(GetIAMPolicyBindingConditionArgs.builder()
                        .description("Expiring at midnight of 2019-12-31")
                        .expression("request.time < timestamp(\"2020-01-01T00:00:00Z\")")
                        .title("expires_after_2019_12_31")
                        .build())
                    .members("user:jane@example.com")
                    .role("roles/compute.admin")
                    .build())
                .build());
    
            var project = new IAMPolicy("project", IAMPolicyArgs.builder()        
                .policyData(admin.applyValue(getIAMPolicyResult -> getIAMPolicyResult.policyData()))
                .project("your-project-id")
                .build());
    
        }
    }
    
    resources:
      project:
        type: gcp:projects:IAMPolicy
        properties:
          policyData: ${admin.policyData}
          project: your-project-id
    variables:
      admin:
        fn::invoke:
          Function: gcp:organizations:getIAMPolicy
          Arguments:
            bindings:
              - condition:
                  description: Expiring at midnight of 2019-12-31
                  expression: request.time < timestamp("2020-01-01T00:00:00Z")
                  title: expires_after_2019_12_31
                members:
                  - user:jane@example.com
                role: roles/compute.admin
    

    google_project_iam_binding

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const project = new gcp.projects.IAMBinding("project", {
        members: ["user:jane@example.com"],
        project: "your-project-id",
        role: "roles/editor",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    project = gcp.projects.IAMBinding("project",
        members=["user:jane@example.com"],
        project="your-project-id",
        role="roles/editor")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var project = new Gcp.Projects.IAMBinding("project", new()
        {
            Members = new[]
            {
                "user:jane@example.com",
            },
            Project = "your-project-id",
            Role = "roles/editor",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/projects"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := projects.NewIAMBinding(ctx, "project", &projects.IAMBindingArgs{
    			Members: pulumi.StringArray{
    				pulumi.String("user:jane@example.com"),
    			},
    			Project: pulumi.String("your-project-id"),
    			Role:    pulumi.String("roles/editor"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.projects.IAMBinding;
    import com.pulumi.gcp.projects.IAMBindingArgs;
    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 project = new IAMBinding("project", IAMBindingArgs.builder()        
                .members("user:jane@example.com")
                .project("your-project-id")
                .role("roles/editor")
                .build());
    
        }
    }
    
    resources:
      project:
        type: gcp:projects:IAMBinding
        properties:
          members:
            - user:jane@example.com
          project: your-project-id
          role: roles/editor
    

    With IAM Conditions:

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const project = new gcp.projects.IAMBinding("project", {
        condition: {
            description: "Expiring at midnight of 2019-12-31",
            expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
            title: "expires_after_2019_12_31",
        },
        members: ["user:jane@example.com"],
        project: "your-project-id",
        role: "roles/container.admin",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    project = gcp.projects.IAMBinding("project",
        condition=gcp.projects.IAMBindingConditionArgs(
            description="Expiring at midnight of 2019-12-31",
            expression="request.time < timestamp(\"2020-01-01T00:00:00Z\")",
            title="expires_after_2019_12_31",
        ),
        members=["user:jane@example.com"],
        project="your-project-id",
        role="roles/container.admin")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var project = new Gcp.Projects.IAMBinding("project", new()
        {
            Condition = new Gcp.Projects.Inputs.IAMBindingConditionArgs
            {
                Description = "Expiring at midnight of 2019-12-31",
                Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
                Title = "expires_after_2019_12_31",
            },
            Members = new[]
            {
                "user:jane@example.com",
            },
            Project = "your-project-id",
            Role = "roles/container.admin",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/projects"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := projects.NewIAMBinding(ctx, "project", &projects.IAMBindingArgs{
    			Condition: &projects.IAMBindingConditionArgs{
    				Description: pulumi.String("Expiring at midnight of 2019-12-31"),
    				Expression:  pulumi.String("request.time < timestamp(\"2020-01-01T00:00:00Z\")"),
    				Title:       pulumi.String("expires_after_2019_12_31"),
    			},
    			Members: pulumi.StringArray{
    				pulumi.String("user:jane@example.com"),
    			},
    			Project: pulumi.String("your-project-id"),
    			Role:    pulumi.String("roles/container.admin"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.projects.IAMBinding;
    import com.pulumi.gcp.projects.IAMBindingArgs;
    import com.pulumi.gcp.projects.inputs.IAMBindingConditionArgs;
    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 project = new IAMBinding("project", IAMBindingArgs.builder()        
                .condition(IAMBindingConditionArgs.builder()
                    .description("Expiring at midnight of 2019-12-31")
                    .expression("request.time < timestamp(\"2020-01-01T00:00:00Z\")")
                    .title("expires_after_2019_12_31")
                    .build())
                .members("user:jane@example.com")
                .project("your-project-id")
                .role("roles/container.admin")
                .build());
    
        }
    }
    
    resources:
      project:
        type: gcp:projects:IAMBinding
        properties:
          condition:
            description: Expiring at midnight of 2019-12-31
            expression: request.time < timestamp("2020-01-01T00:00:00Z")
            title: expires_after_2019_12_31
          members:
            - user:jane@example.com
          project: your-project-id
          role: roles/container.admin
    

    google_project_iam_member

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const project = new gcp.projects.IAMMember("project", {
        member: "user:jane@example.com",
        project: "your-project-id",
        role: "roles/editor",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    project = gcp.projects.IAMMember("project",
        member="user:jane@example.com",
        project="your-project-id",
        role="roles/editor")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var project = new Gcp.Projects.IAMMember("project", new()
        {
            Member = "user:jane@example.com",
            Project = "your-project-id",
            Role = "roles/editor",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/projects"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := projects.NewIAMMember(ctx, "project", &projects.IAMMemberArgs{
    			Member:  pulumi.String("user:jane@example.com"),
    			Project: pulumi.String("your-project-id"),
    			Role:    pulumi.String("roles/editor"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.projects.IAMMember;
    import com.pulumi.gcp.projects.IAMMemberArgs;
    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 project = new IAMMember("project", IAMMemberArgs.builder()        
                .member("user:jane@example.com")
                .project("your-project-id")
                .role("roles/editor")
                .build());
    
        }
    }
    
    resources:
      project:
        type: gcp:projects:IAMMember
        properties:
          member: user:jane@example.com
          project: your-project-id
          role: roles/editor
    

    With IAM Conditions:

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const project = new gcp.projects.IAMMember("project", {
        condition: {
            description: "Expiring at midnight of 2019-12-31",
            expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
            title: "expires_after_2019_12_31",
        },
        member: "user:jane@example.com",
        project: "your-project-id",
        role: "roles/firebase.admin",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    project = gcp.projects.IAMMember("project",
        condition=gcp.projects.IAMMemberConditionArgs(
            description="Expiring at midnight of 2019-12-31",
            expression="request.time < timestamp(\"2020-01-01T00:00:00Z\")",
            title="expires_after_2019_12_31",
        ),
        member="user:jane@example.com",
        project="your-project-id",
        role="roles/firebase.admin")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var project = new Gcp.Projects.IAMMember("project", new()
        {
            Condition = new Gcp.Projects.Inputs.IAMMemberConditionArgs
            {
                Description = "Expiring at midnight of 2019-12-31",
                Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
                Title = "expires_after_2019_12_31",
            },
            Member = "user:jane@example.com",
            Project = "your-project-id",
            Role = "roles/firebase.admin",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/projects"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := projects.NewIAMMember(ctx, "project", &projects.IAMMemberArgs{
    			Condition: &projects.IAMMemberConditionArgs{
    				Description: pulumi.String("Expiring at midnight of 2019-12-31"),
    				Expression:  pulumi.String("request.time < timestamp(\"2020-01-01T00:00:00Z\")"),
    				Title:       pulumi.String("expires_after_2019_12_31"),
    			},
    			Member:  pulumi.String("user:jane@example.com"),
    			Project: pulumi.String("your-project-id"),
    			Role:    pulumi.String("roles/firebase.admin"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.projects.IAMMember;
    import com.pulumi.gcp.projects.IAMMemberArgs;
    import com.pulumi.gcp.projects.inputs.IAMMemberConditionArgs;
    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 project = new IAMMember("project", IAMMemberArgs.builder()        
                .condition(IAMMemberConditionArgs.builder()
                    .description("Expiring at midnight of 2019-12-31")
                    .expression("request.time < timestamp(\"2020-01-01T00:00:00Z\")")
                    .title("expires_after_2019_12_31")
                    .build())
                .member("user:jane@example.com")
                .project("your-project-id")
                .role("roles/firebase.admin")
                .build());
    
        }
    }
    
    resources:
      project:
        type: gcp:projects:IAMMember
        properties:
          condition:
            description: Expiring at midnight of 2019-12-31
            expression: request.time < timestamp("2020-01-01T00:00:00Z")
            title: expires_after_2019_12_31
          member: user:jane@example.com
          project: your-project-id
          role: roles/firebase.admin
    

    google_project_iam_audit_config

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const project = new gcp.projects.IAMAuditConfig("project", {
        auditLogConfigs: [
            {
                logType: "ADMIN_READ",
            },
            {
                exemptedMembers: ["user:joebloggs@hashicorp.com"],
                logType: "DATA_READ",
            },
        ],
        project: "your-project-id",
        service: "allServices",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    project = gcp.projects.IAMAuditConfig("project",
        audit_log_configs=[
            gcp.projects.IAMAuditConfigAuditLogConfigArgs(
                log_type="ADMIN_READ",
            ),
            gcp.projects.IAMAuditConfigAuditLogConfigArgs(
                exempted_members=["user:joebloggs@hashicorp.com"],
                log_type="DATA_READ",
            ),
        ],
        project="your-project-id",
        service="allServices")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var project = new Gcp.Projects.IAMAuditConfig("project", new()
        {
            AuditLogConfigs = new[]
            {
                new Gcp.Projects.Inputs.IAMAuditConfigAuditLogConfigArgs
                {
                    LogType = "ADMIN_READ",
                },
                new Gcp.Projects.Inputs.IAMAuditConfigAuditLogConfigArgs
                {
                    ExemptedMembers = new[]
                    {
                        "user:joebloggs@hashicorp.com",
                    },
                    LogType = "DATA_READ",
                },
            },
            Project = "your-project-id",
            Service = "allServices",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/projects"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := projects.NewIAMAuditConfig(ctx, "project", &projects.IAMAuditConfigArgs{
    			AuditLogConfigs: projects.IAMAuditConfigAuditLogConfigArray{
    				&projects.IAMAuditConfigAuditLogConfigArgs{
    					LogType: pulumi.String("ADMIN_READ"),
    				},
    				&projects.IAMAuditConfigAuditLogConfigArgs{
    					ExemptedMembers: pulumi.StringArray{
    						pulumi.String("user:joebloggs@hashicorp.com"),
    					},
    					LogType: pulumi.String("DATA_READ"),
    				},
    			},
    			Project: pulumi.String("your-project-id"),
    			Service: pulumi.String("allServices"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.projects.IAMAuditConfig;
    import com.pulumi.gcp.projects.IAMAuditConfigArgs;
    import com.pulumi.gcp.projects.inputs.IAMAuditConfigAuditLogConfigArgs;
    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 project = new IAMAuditConfig("project", IAMAuditConfigArgs.builder()        
                .auditLogConfigs(            
                    IAMAuditConfigAuditLogConfigArgs.builder()
                        .logType("ADMIN_READ")
                        .build(),
                    IAMAuditConfigAuditLogConfigArgs.builder()
                        .exemptedMembers("user:joebloggs@hashicorp.com")
                        .logType("DATA_READ")
                        .build())
                .project("your-project-id")
                .service("allServices")
                .build());
    
        }
    }
    
    resources:
      project:
        type: gcp:projects:IAMAuditConfig
        properties:
          auditLogConfigs:
            - logType: ADMIN_READ
            - exemptedMembers:
                - user:joebloggs@hashicorp.com
              logType: DATA_READ
          project: your-project-id
          service: allServices
    

    Create IAMMember Resource

    new IAMMember(name: string, args: IAMMemberArgs, opts?: CustomResourceOptions);
    @overload
    def IAMMember(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  condition: Optional[IAMMemberConditionArgs] = None,
                  member: Optional[str] = None,
                  project: Optional[str] = None,
                  role: Optional[str] = None)
    @overload
    def IAMMember(resource_name: str,
                  args: IAMMemberArgs,
                  opts: Optional[ResourceOptions] = None)
    func NewIAMMember(ctx *Context, name string, args IAMMemberArgs, opts ...ResourceOption) (*IAMMember, error)
    public IAMMember(string name, IAMMemberArgs args, CustomResourceOptions? opts = null)
    public IAMMember(String name, IAMMemberArgs args)
    public IAMMember(String name, IAMMemberArgs args, CustomResourceOptions options)
    
    type: gcp:projects:IAMMember
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args IAMMemberArgs
    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 IAMMemberArgs
    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 IAMMemberArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args IAMMemberArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args IAMMemberArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    IAMMember Resource Properties

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

    Inputs

    The IAMMember resource accepts the following input properties:

    Member string
    Project string

    The project id of the target project. This is not inferred from the provider.

    Role string

    The role that should be applied. Only one gcp.projects.IAMBinding can be used per role. Note that custom roles must be of the format [projects|organizations]/{parent-name}/roles/{role-name}.

    Condition IAMMemberConditionArgs

    An IAM Condition for a given binding. Structure is documented below.

    Member string
    Project string

    The project id of the target project. This is not inferred from the provider.

    Role string

    The role that should be applied. Only one gcp.projects.IAMBinding can be used per role. Note that custom roles must be of the format [projects|organizations]/{parent-name}/roles/{role-name}.

    Condition IAMMemberConditionArgs

    An IAM Condition for a given binding. Structure is documented below.

    member String
    project String

    The project id of the target project. This is not inferred from the provider.

    role String

    The role that should be applied. Only one gcp.projects.IAMBinding can be used per role. Note that custom roles must be of the format [projects|organizations]/{parent-name}/roles/{role-name}.

    condition IAMMemberConditionArgs

    An IAM Condition for a given binding. Structure is documented below.

    member string
    project string

    The project id of the target project. This is not inferred from the provider.

    role string

    The role that should be applied. Only one gcp.projects.IAMBinding can be used per role. Note that custom roles must be of the format [projects|organizations]/{parent-name}/roles/{role-name}.

    condition IAMMemberConditionArgs

    An IAM Condition for a given binding. Structure is documented below.

    member str
    project str

    The project id of the target project. This is not inferred from the provider.

    role str

    The role that should be applied. Only one gcp.projects.IAMBinding can be used per role. Note that custom roles must be of the format [projects|organizations]/{parent-name}/roles/{role-name}.

    condition IAMMemberConditionArgs

    An IAM Condition for a given binding. Structure is documented below.

    member String
    project String

    The project id of the target project. This is not inferred from the provider.

    role String

    The role that should be applied. Only one gcp.projects.IAMBinding can be used per role. Note that custom roles must be of the format [projects|organizations]/{parent-name}/roles/{role-name}.

    condition Property Map

    An IAM Condition for a given binding. Structure is documented below.

    Outputs

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

    Etag string

    (Computed) The etag of the project's IAM policy.

    Id string

    The provider-assigned unique ID for this managed resource.

    Etag string

    (Computed) The etag of the project's IAM policy.

    Id string

    The provider-assigned unique ID for this managed resource.

    etag String

    (Computed) The etag of the project's IAM policy.

    id String

    The provider-assigned unique ID for this managed resource.

    etag string

    (Computed) The etag of the project's IAM policy.

    id string

    The provider-assigned unique ID for this managed resource.

    etag str

    (Computed) The etag of the project's IAM policy.

    id str

    The provider-assigned unique ID for this managed resource.

    etag String

    (Computed) The etag of the project's IAM policy.

    id String

    The provider-assigned unique ID for this managed resource.

    Look up Existing IAMMember Resource

    Get an existing IAMMember 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?: IAMMemberState, opts?: CustomResourceOptions): IAMMember
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            condition: Optional[IAMMemberConditionArgs] = None,
            etag: Optional[str] = None,
            member: Optional[str] = None,
            project: Optional[str] = None,
            role: Optional[str] = None) -> IAMMember
    func GetIAMMember(ctx *Context, name string, id IDInput, state *IAMMemberState, opts ...ResourceOption) (*IAMMember, error)
    public static IAMMember Get(string name, Input<string> id, IAMMemberState? state, CustomResourceOptions? opts = null)
    public static IAMMember get(String name, Output<String> id, IAMMemberState 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:
    Condition IAMMemberConditionArgs

    An IAM Condition for a given binding. Structure is documented below.

    Etag string

    (Computed) The etag of the project's IAM policy.

    Member string
    Project string

    The project id of the target project. This is not inferred from the provider.

    Role string

    The role that should be applied. Only one gcp.projects.IAMBinding can be used per role. Note that custom roles must be of the format [projects|organizations]/{parent-name}/roles/{role-name}.

    Condition IAMMemberConditionArgs

    An IAM Condition for a given binding. Structure is documented below.

    Etag string

    (Computed) The etag of the project's IAM policy.

    Member string
    Project string

    The project id of the target project. This is not inferred from the provider.

    Role string

    The role that should be applied. Only one gcp.projects.IAMBinding can be used per role. Note that custom roles must be of the format [projects|organizations]/{parent-name}/roles/{role-name}.

    condition IAMMemberConditionArgs

    An IAM Condition for a given binding. Structure is documented below.

    etag String

    (Computed) The etag of the project's IAM policy.

    member String
    project String

    The project id of the target project. This is not inferred from the provider.

    role String

    The role that should be applied. Only one gcp.projects.IAMBinding can be used per role. Note that custom roles must be of the format [projects|organizations]/{parent-name}/roles/{role-name}.

    condition IAMMemberConditionArgs

    An IAM Condition for a given binding. Structure is documented below.

    etag string

    (Computed) The etag of the project's IAM policy.

    member string
    project string

    The project id of the target project. This is not inferred from the provider.

    role string

    The role that should be applied. Only one gcp.projects.IAMBinding can be used per role. Note that custom roles must be of the format [projects|organizations]/{parent-name}/roles/{role-name}.

    condition IAMMemberConditionArgs

    An IAM Condition for a given binding. Structure is documented below.

    etag str

    (Computed) The etag of the project's IAM policy.

    member str
    project str

    The project id of the target project. This is not inferred from the provider.

    role str

    The role that should be applied. Only one gcp.projects.IAMBinding can be used per role. Note that custom roles must be of the format [projects|organizations]/{parent-name}/roles/{role-name}.

    condition Property Map

    An IAM Condition for a given binding. Structure is documented below.

    etag String

    (Computed) The etag of the project's IAM policy.

    member String
    project String

    The project id of the target project. This is not inferred from the provider.

    role String

    The role that should be applied. Only one gcp.projects.IAMBinding can be used per role. Note that custom roles must be of the format [projects|organizations]/{parent-name}/roles/{role-name}.

    Supporting Types

    IAMMemberCondition

    Expression string

    Textual representation of an expression in Common Expression Language syntax.

    Title string

    A title for the expression, i.e. a short string describing its purpose.

    Description string

    An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.

    Warning: This provider considers the role and condition contents (title+description+expression) as the identifier for the binding. This means that if any part of the condition is changed out-of-band, the provider will consider it to be an entirely different resource and will treat it as such.

    Expression string

    Textual representation of an expression in Common Expression Language syntax.

    Title string

    A title for the expression, i.e. a short string describing its purpose.

    Description string

    An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.

    Warning: This provider considers the role and condition contents (title+description+expression) as the identifier for the binding. This means that if any part of the condition is changed out-of-band, the provider will consider it to be an entirely different resource and will treat it as such.

    expression String

    Textual representation of an expression in Common Expression Language syntax.

    title String

    A title for the expression, i.e. a short string describing its purpose.

    description String

    An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.

    Warning: This provider considers the role and condition contents (title+description+expression) as the identifier for the binding. This means that if any part of the condition is changed out-of-band, the provider will consider it to be an entirely different resource and will treat it as such.

    expression string

    Textual representation of an expression in Common Expression Language syntax.

    title string

    A title for the expression, i.e. a short string describing its purpose.

    description string

    An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.

    Warning: This provider considers the role and condition contents (title+description+expression) as the identifier for the binding. This means that if any part of the condition is changed out-of-band, the provider will consider it to be an entirely different resource and will treat it as such.

    expression str

    Textual representation of an expression in Common Expression Language syntax.

    title str

    A title for the expression, i.e. a short string describing its purpose.

    description str

    An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.

    Warning: This provider considers the role and condition contents (title+description+expression) as the identifier for the binding. This means that if any part of the condition is changed out-of-band, the provider will consider it to be an entirely different resource and will treat it as such.

    expression String

    Textual representation of an expression in Common Expression Language syntax.

    title String

    A title for the expression, i.e. a short string describing its purpose.

    description String

    An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.

    Warning: This provider considers the role and condition contents (title+description+expression) as the identifier for the binding. This means that if any part of the condition is changed out-of-band, the provider will consider it to be an entirely different resource and will treat it as such.

    Import

    IAM member imports use space-delimited identifiers; the resource in question, the role, and the account.

    This member resource can be imported using the project_id, role, and member e.g.

     $ pulumi import gcp:projects/iAMMember:IAMMember my_project "your-project-id roles/viewer user:foo@example.com"
    

    IAM binding imports use space-delimited identifiers; the resource in question and the role.

    This binding resource can be imported using the project_id and role, e.g.

     $ pulumi import gcp:projects/iAMMember:IAMMember my_project "your-project-id roles/viewer"
    

    IAM policy imports use the identifier of the resource in question.

    This policy resource can be imported using the project_id.

     $ pulumi import gcp:projects/iAMMember:IAMMember my_project your-project-id
    

    IAM audit config imports use the identifier of the resource in question and the service, e.g.

     $ pulumi import gcp:projects/iAMMember:IAMMember my_project "your-project-id foo.googleapis.com"
    

    -> Custom RolesIf 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. -> Conditional IAM BindingsIf you’re importing a IAM binding with a condition block, make sure

     $ pulumi import gcp:projects/iAMMember:IAMMember to include the title of condition, e.g. `google_project_iam_binding.my_project "{{your-project-id}} roles/{{role_id}} condition-title"`
    

    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 v6.57.0 published on Tuesday, May 30, 2023 by Pulumi