gcp.organizations.IAMMember
Explore with Pulumi AI
Four different resources help you manage your IAM policy for a organization. Each of these resources serves a different use case:
gcp.organizations.IAMPolicy
: Authoritative. Sets the IAM policy for the organization and replaces any existing policy already attached.gcp.organizations.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 organization are preserved.gcp.organizations.IAMMember
: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the organization are preserved.gcp.organizations.IamAuditConfig
: Authoritative for a given service. Updates the IAM policy to enable audit logging for the given service.
Note:
gcp.organizations.IAMPolicy
cannot be used in conjunction withgcp.organizations.IAMBinding
,gcp.organizations.IAMMember
, orgcp.organizations.IamAuditConfig
or they will fight over what your policy should be.
Note:
gcp.organizations.IAMBinding
resources can be used in conjunction withgcp.organizations.IAMMember
resources only if they do not grant privilege to the same role.
gcp.organizations.IAMPolicy
!> Warning: New organizations have several default policies which will,
without extreme caution, be overwritten by use of this resource.
The safest alternative is to use multiple gcp.organizations.IAMBinding
resources. This resource makes it easy to remove your own access to
an organization, which will require a call to Google Support to have
fixed, and can take multiple days to resolve.
In general, this resource should only be used with organizations fully managed by this provider.I f you do use this resource, the best way to be sure that you are not making dangerous changes is to start by importing your existing policy, and examining the diff very closely.
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 organization = new gcp.organizations.IAMPolicy("organization", {
orgId: "1234567890",
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"],
)])
organization = gcp.organizations.IAMPolicy("organization",
org_id="1234567890",
policy_data=admin.policy_data)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"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 = organizations.NewIAMPolicy(ctx, "organization", &organizations.IAMPolicyArgs{
OrgId: pulumi.String("1234567890"),
PolicyData: pulumi.String(admin.PolicyData),
})
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 admin = Gcp.Organizations.GetIAMPolicy.Invoke(new()
{
Bindings = new[]
{
new Gcp.Organizations.Inputs.GetIAMPolicyBindingInputArgs
{
Role = "roles/editor",
Members = new[]
{
"user:jane@example.com",
},
},
},
});
var organization = new Gcp.Organizations.IAMPolicy("organization", new()
{
OrgId = "1234567890",
PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
});
});
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.organizations.IAMPolicy;
import com.pulumi.gcp.organizations.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 organization = new IAMPolicy("organization", IAMPolicyArgs.builder()
.orgId("1234567890")
.policyData(admin.applyValue(getIAMPolicyResult -> getIAMPolicyResult.policyData()))
.build());
}
}
resources:
organization:
type: gcp:organizations:IAMPolicy
properties:
orgId: '1234567890'
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: [{
role: "roles/editor",
members: ["user:jane@example.com"],
condition: {
title: "expires_after_2019_12_31",
description: "Expiring at midnight of 2019-12-31",
expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
}],
});
const organization = new gcp.organizations.IAMPolicy("organization", {
orgId: "1234567890",
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"],
condition=gcp.organizations.GetIAMPolicyBindingConditionArgs(
title="expires_after_2019_12_31",
description="Expiring at midnight of 2019-12-31",
expression="request.time < timestamp(\"2020-01-01T00:00:00Z\")",
),
)])
organization = gcp.organizations.IAMPolicy("organization",
org_id="1234567890",
policy_data=admin.policy_data)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"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",
},
Condition: {
Title: "expires_after_2019_12_31",
Description: pulumi.StringRef("Expiring at midnight of 2019-12-31"),
Expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
},
},
}, nil)
if err != nil {
return err
}
_, err = organizations.NewIAMPolicy(ctx, "organization", &organizations.IAMPolicyArgs{
OrgId: pulumi.String("1234567890"),
PolicyData: pulumi.String(admin.PolicyData),
})
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 admin = Gcp.Organizations.GetIAMPolicy.Invoke(new()
{
Bindings = new[]
{
new Gcp.Organizations.Inputs.GetIAMPolicyBindingInputArgs
{
Role = "roles/editor",
Members = new[]
{
"user:jane@example.com",
},
Condition = new Gcp.Organizations.Inputs.GetIAMPolicyBindingConditionInputArgs
{
Title = "expires_after_2019_12_31",
Description = "Expiring at midnight of 2019-12-31",
Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
},
},
});
var organization = new Gcp.Organizations.IAMPolicy("organization", new()
{
OrgId = "1234567890",
PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
});
});
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.organizations.IAMPolicy;
import com.pulumi.gcp.organizations.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")
.condition(GetIAMPolicyBindingConditionArgs.builder()
.title("expires_after_2019_12_31")
.description("Expiring at midnight of 2019-12-31")
.expression("request.time < timestamp(\"2020-01-01T00:00:00Z\")")
.build())
.build())
.build());
var organization = new IAMPolicy("organization", IAMPolicyArgs.builder()
.orgId("1234567890")
.policyData(admin.applyValue(getIAMPolicyResult -> getIAMPolicyResult.policyData()))
.build());
}
}
resources:
organization:
type: gcp:organizations:IAMPolicy
properties:
orgId: '1234567890'
policyData: ${admin.policyData}
variables:
admin:
fn::invoke:
Function: gcp:organizations:getIAMPolicy
Arguments:
bindings:
- role: roles/editor
members:
- user:jane@example.com
condition:
title: expires_after_2019_12_31
description: Expiring at midnight of 2019-12-31
expression: request.time < timestamp("2020-01-01T00:00:00Z")
gcp.organizations.IAMBinding
Note: If
role
is set toroles/owner
and you don’t specify a user or service account you have access to inmembers
, you can lock yourself out of your organization.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const organization = new gcp.organizations.IAMBinding("organization", {
orgId: "1234567890",
role: "roles/editor",
members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp
organization = gcp.organizations.IAMBinding("organization",
org_id="1234567890",
role="roles/editor",
members=["user:jane@example.com"])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewIAMBinding(ctx, "organization", &organizations.IAMBindingArgs{
OrgId: pulumi.String("1234567890"),
Role: pulumi.String("roles/editor"),
Members: pulumi.StringArray{
pulumi.String("user:jane@example.com"),
},
})
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 organization = new Gcp.Organizations.IAMBinding("organization", new()
{
OrgId = "1234567890",
Role = "roles/editor",
Members = new[]
{
"user:jane@example.com",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.IAMBinding;
import com.pulumi.gcp.organizations.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 organization = new IAMBinding("organization", IAMBindingArgs.builder()
.orgId("1234567890")
.role("roles/editor")
.members("user:jane@example.com")
.build());
}
}
resources:
organization:
type: gcp:organizations:IAMBinding
properties:
orgId: '1234567890'
role: roles/editor
members:
- user:jane@example.com
With IAM Conditions:
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const organization = new gcp.organizations.IAMBinding("organization", {
orgId: "1234567890",
role: "roles/editor",
members: ["user:jane@example.com"],
condition: {
title: "expires_after_2019_12_31",
description: "Expiring at midnight of 2019-12-31",
expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
});
import pulumi
import pulumi_gcp as gcp
organization = gcp.organizations.IAMBinding("organization",
org_id="1234567890",
role="roles/editor",
members=["user:jane@example.com"],
condition=gcp.organizations.IAMBindingConditionArgs(
title="expires_after_2019_12_31",
description="Expiring at midnight of 2019-12-31",
expression="request.time < timestamp(\"2020-01-01T00:00:00Z\")",
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewIAMBinding(ctx, "organization", &organizations.IAMBindingArgs{
OrgId: pulumi.String("1234567890"),
Role: pulumi.String("roles/editor"),
Members: pulumi.StringArray{
pulumi.String("user:jane@example.com"),
},
Condition: &organizations.IAMBindingConditionArgs{
Title: pulumi.String("expires_after_2019_12_31"),
Description: pulumi.String("Expiring at midnight of 2019-12-31"),
Expression: pulumi.String("request.time < timestamp(\"2020-01-01T00:00:00Z\")"),
},
})
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 organization = new Gcp.Organizations.IAMBinding("organization", new()
{
OrgId = "1234567890",
Role = "roles/editor",
Members = new[]
{
"user:jane@example.com",
},
Condition = new Gcp.Organizations.Inputs.IAMBindingConditionArgs
{
Title = "expires_after_2019_12_31",
Description = "Expiring at midnight of 2019-12-31",
Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.IAMBinding;
import com.pulumi.gcp.organizations.IAMBindingArgs;
import com.pulumi.gcp.organizations.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 organization = new IAMBinding("organization", IAMBindingArgs.builder()
.orgId("1234567890")
.role("roles/editor")
.members("user:jane@example.com")
.condition(IAMBindingConditionArgs.builder()
.title("expires_after_2019_12_31")
.description("Expiring at midnight of 2019-12-31")
.expression("request.time < timestamp(\"2020-01-01T00:00:00Z\")")
.build())
.build());
}
}
resources:
organization:
type: gcp:organizations:IAMBinding
properties:
orgId: '1234567890'
role: roles/editor
members:
- user:jane@example.com
condition:
title: expires_after_2019_12_31
description: Expiring at midnight of 2019-12-31
expression: request.time < timestamp("2020-01-01T00:00:00Z")
gcp.organizations.IAMMember
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const organization = new gcp.organizations.IAMMember("organization", {
orgId: "1234567890",
role: "roles/editor",
member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
organization = gcp.organizations.IAMMember("organization",
org_id="1234567890",
role="roles/editor",
member="user:jane@example.com")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewIAMMember(ctx, "organization", &organizations.IAMMemberArgs{
OrgId: pulumi.String("1234567890"),
Role: pulumi.String("roles/editor"),
Member: pulumi.String("user:jane@example.com"),
})
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 organization = new Gcp.Organizations.IAMMember("organization", new()
{
OrgId = "1234567890",
Role = "roles/editor",
Member = "user:jane@example.com",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.IAMMember;
import com.pulumi.gcp.organizations.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 organization = new IAMMember("organization", IAMMemberArgs.builder()
.orgId("1234567890")
.role("roles/editor")
.member("user:jane@example.com")
.build());
}
}
resources:
organization:
type: gcp:organizations:IAMMember
properties:
orgId: '1234567890'
role: roles/editor
member: user:jane@example.com
With IAM Conditions:
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const organization = new gcp.organizations.IAMMember("organization", {
orgId: "1234567890",
role: "roles/editor",
member: "user:jane@example.com",
condition: {
title: "expires_after_2019_12_31",
description: "Expiring at midnight of 2019-12-31",
expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
});
import pulumi
import pulumi_gcp as gcp
organization = gcp.organizations.IAMMember("organization",
org_id="1234567890",
role="roles/editor",
member="user:jane@example.com",
condition=gcp.organizations.IAMMemberConditionArgs(
title="expires_after_2019_12_31",
description="Expiring at midnight of 2019-12-31",
expression="request.time < timestamp(\"2020-01-01T00:00:00Z\")",
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewIAMMember(ctx, "organization", &organizations.IAMMemberArgs{
OrgId: pulumi.String("1234567890"),
Role: pulumi.String("roles/editor"),
Member: pulumi.String("user:jane@example.com"),
Condition: &organizations.IAMMemberConditionArgs{
Title: pulumi.String("expires_after_2019_12_31"),
Description: pulumi.String("Expiring at midnight of 2019-12-31"),
Expression: pulumi.String("request.time < timestamp(\"2020-01-01T00:00:00Z\")"),
},
})
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 organization = new Gcp.Organizations.IAMMember("organization", new()
{
OrgId = "1234567890",
Role = "roles/editor",
Member = "user:jane@example.com",
Condition = new Gcp.Organizations.Inputs.IAMMemberConditionArgs
{
Title = "expires_after_2019_12_31",
Description = "Expiring at midnight of 2019-12-31",
Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.IAMMember;
import com.pulumi.gcp.organizations.IAMMemberArgs;
import com.pulumi.gcp.organizations.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 organization = new IAMMember("organization", IAMMemberArgs.builder()
.orgId("1234567890")
.role("roles/editor")
.member("user:jane@example.com")
.condition(IAMMemberConditionArgs.builder()
.title("expires_after_2019_12_31")
.description("Expiring at midnight of 2019-12-31")
.expression("request.time < timestamp(\"2020-01-01T00:00:00Z\")")
.build())
.build());
}
}
resources:
organization:
type: gcp:organizations:IAMMember
properties:
orgId: '1234567890'
role: roles/editor
member: user:jane@example.com
condition:
title: expires_after_2019_12_31
description: Expiring at midnight of 2019-12-31
expression: request.time < timestamp("2020-01-01T00:00:00Z")
gcp.organizations.IamAuditConfig
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const organization = new gcp.organizations.IamAuditConfig("organization", {
orgId: "1234567890",
service: "allServices",
auditLogConfigs: [
{
logType: "ADMIN_READ",
},
{
logType: "DATA_READ",
exemptedMembers: ["user:joebloggs@example.com"],
},
],
});
import pulumi
import pulumi_gcp as gcp
organization = gcp.organizations.IamAuditConfig("organization",
org_id="1234567890",
service="allServices",
audit_log_configs=[
gcp.organizations.IamAuditConfigAuditLogConfigArgs(
log_type="ADMIN_READ",
),
gcp.organizations.IamAuditConfigAuditLogConfigArgs(
log_type="DATA_READ",
exempted_members=["user:joebloggs@example.com"],
),
])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewIamAuditConfig(ctx, "organization", &organizations.IamAuditConfigArgs{
OrgId: pulumi.String("1234567890"),
Service: pulumi.String("allServices"),
AuditLogConfigs: organizations.IamAuditConfigAuditLogConfigArray{
&organizations.IamAuditConfigAuditLogConfigArgs{
LogType: pulumi.String("ADMIN_READ"),
},
&organizations.IamAuditConfigAuditLogConfigArgs{
LogType: pulumi.String("DATA_READ"),
ExemptedMembers: pulumi.StringArray{
pulumi.String("user:joebloggs@example.com"),
},
},
},
})
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 organization = new Gcp.Organizations.IamAuditConfig("organization", new()
{
OrgId = "1234567890",
Service = "allServices",
AuditLogConfigs = new[]
{
new Gcp.Organizations.Inputs.IamAuditConfigAuditLogConfigArgs
{
LogType = "ADMIN_READ",
},
new Gcp.Organizations.Inputs.IamAuditConfigAuditLogConfigArgs
{
LogType = "DATA_READ",
ExemptedMembers = new[]
{
"user:joebloggs@example.com",
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.IamAuditConfig;
import com.pulumi.gcp.organizations.IamAuditConfigArgs;
import com.pulumi.gcp.organizations.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 organization = new IamAuditConfig("organization", IamAuditConfigArgs.builder()
.orgId("1234567890")
.service("allServices")
.auditLogConfigs(
IamAuditConfigAuditLogConfigArgs.builder()
.logType("ADMIN_READ")
.build(),
IamAuditConfigAuditLogConfigArgs.builder()
.logType("DATA_READ")
.exemptedMembers("user:joebloggs@example.com")
.build())
.build());
}
}
resources:
organization:
type: gcp:organizations:IamAuditConfig
properties:
orgId: '1234567890'
service: allServices
auditLogConfigs:
- logType: ADMIN_READ
- logType: DATA_READ
exemptedMembers:
- user:joebloggs@example.com
gcp.organizations.IAMPolicy
!> Warning: New organizations have several default policies which will,
without extreme caution, be overwritten by use of this resource.
The safest alternative is to use multiple gcp.organizations.IAMBinding
resources. This resource makes it easy to remove your own access to
an organization, which will require a call to Google Support to have
fixed, and can take multiple days to resolve.
In general, this resource should only be used with organizations fully managed by this provider.I f you do use this resource, the best way to be sure that you are not making dangerous changes is to start by importing your existing policy, and examining the diff very closely.
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 organization = new gcp.organizations.IAMPolicy("organization", {
orgId: "1234567890",
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"],
)])
organization = gcp.organizations.IAMPolicy("organization",
org_id="1234567890",
policy_data=admin.policy_data)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"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 = organizations.NewIAMPolicy(ctx, "organization", &organizations.IAMPolicyArgs{
OrgId: pulumi.String("1234567890"),
PolicyData: pulumi.String(admin.PolicyData),
})
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 admin = Gcp.Organizations.GetIAMPolicy.Invoke(new()
{
Bindings = new[]
{
new Gcp.Organizations.Inputs.GetIAMPolicyBindingInputArgs
{
Role = "roles/editor",
Members = new[]
{
"user:jane@example.com",
},
},
},
});
var organization = new Gcp.Organizations.IAMPolicy("organization", new()
{
OrgId = "1234567890",
PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
});
});
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.organizations.IAMPolicy;
import com.pulumi.gcp.organizations.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 organization = new IAMPolicy("organization", IAMPolicyArgs.builder()
.orgId("1234567890")
.policyData(admin.applyValue(getIAMPolicyResult -> getIAMPolicyResult.policyData()))
.build());
}
}
resources:
organization:
type: gcp:organizations:IAMPolicy
properties:
orgId: '1234567890'
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: [{
role: "roles/editor",
members: ["user:jane@example.com"],
condition: {
title: "expires_after_2019_12_31",
description: "Expiring at midnight of 2019-12-31",
expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
}],
});
const organization = new gcp.organizations.IAMPolicy("organization", {
orgId: "1234567890",
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"],
condition=gcp.organizations.GetIAMPolicyBindingConditionArgs(
title="expires_after_2019_12_31",
description="Expiring at midnight of 2019-12-31",
expression="request.time < timestamp(\"2020-01-01T00:00:00Z\")",
),
)])
organization = gcp.organizations.IAMPolicy("organization",
org_id="1234567890",
policy_data=admin.policy_data)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"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",
},
Condition: {
Title: "expires_after_2019_12_31",
Description: pulumi.StringRef("Expiring at midnight of 2019-12-31"),
Expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
},
},
}, nil)
if err != nil {
return err
}
_, err = organizations.NewIAMPolicy(ctx, "organization", &organizations.IAMPolicyArgs{
OrgId: pulumi.String("1234567890"),
PolicyData: pulumi.String(admin.PolicyData),
})
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 admin = Gcp.Organizations.GetIAMPolicy.Invoke(new()
{
Bindings = new[]
{
new Gcp.Organizations.Inputs.GetIAMPolicyBindingInputArgs
{
Role = "roles/editor",
Members = new[]
{
"user:jane@example.com",
},
Condition = new Gcp.Organizations.Inputs.GetIAMPolicyBindingConditionInputArgs
{
Title = "expires_after_2019_12_31",
Description = "Expiring at midnight of 2019-12-31",
Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
},
},
});
var organization = new Gcp.Organizations.IAMPolicy("organization", new()
{
OrgId = "1234567890",
PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
});
});
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.organizations.IAMPolicy;
import com.pulumi.gcp.organizations.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")
.condition(GetIAMPolicyBindingConditionArgs.builder()
.title("expires_after_2019_12_31")
.description("Expiring at midnight of 2019-12-31")
.expression("request.time < timestamp(\"2020-01-01T00:00:00Z\")")
.build())
.build())
.build());
var organization = new IAMPolicy("organization", IAMPolicyArgs.builder()
.orgId("1234567890")
.policyData(admin.applyValue(getIAMPolicyResult -> getIAMPolicyResult.policyData()))
.build());
}
}
resources:
organization:
type: gcp:organizations:IAMPolicy
properties:
orgId: '1234567890'
policyData: ${admin.policyData}
variables:
admin:
fn::invoke:
Function: gcp:organizations:getIAMPolicy
Arguments:
bindings:
- role: roles/editor
members:
- user:jane@example.com
condition:
title: expires_after_2019_12_31
description: Expiring at midnight of 2019-12-31
expression: request.time < timestamp("2020-01-01T00:00:00Z")
gcp.organizations.IAMBinding
Note: If
role
is set toroles/owner
and you don’t specify a user or service account you have access to inmembers
, you can lock yourself out of your organization.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const organization = new gcp.organizations.IAMBinding("organization", {
orgId: "1234567890",
role: "roles/editor",
members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp
organization = gcp.organizations.IAMBinding("organization",
org_id="1234567890",
role="roles/editor",
members=["user:jane@example.com"])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewIAMBinding(ctx, "organization", &organizations.IAMBindingArgs{
OrgId: pulumi.String("1234567890"),
Role: pulumi.String("roles/editor"),
Members: pulumi.StringArray{
pulumi.String("user:jane@example.com"),
},
})
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 organization = new Gcp.Organizations.IAMBinding("organization", new()
{
OrgId = "1234567890",
Role = "roles/editor",
Members = new[]
{
"user:jane@example.com",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.IAMBinding;
import com.pulumi.gcp.organizations.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 organization = new IAMBinding("organization", IAMBindingArgs.builder()
.orgId("1234567890")
.role("roles/editor")
.members("user:jane@example.com")
.build());
}
}
resources:
organization:
type: gcp:organizations:IAMBinding
properties:
orgId: '1234567890'
role: roles/editor
members:
- user:jane@example.com
With IAM Conditions:
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const organization = new gcp.organizations.IAMBinding("organization", {
orgId: "1234567890",
role: "roles/editor",
members: ["user:jane@example.com"],
condition: {
title: "expires_after_2019_12_31",
description: "Expiring at midnight of 2019-12-31",
expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
});
import pulumi
import pulumi_gcp as gcp
organization = gcp.organizations.IAMBinding("organization",
org_id="1234567890",
role="roles/editor",
members=["user:jane@example.com"],
condition=gcp.organizations.IAMBindingConditionArgs(
title="expires_after_2019_12_31",
description="Expiring at midnight of 2019-12-31",
expression="request.time < timestamp(\"2020-01-01T00:00:00Z\")",
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewIAMBinding(ctx, "organization", &organizations.IAMBindingArgs{
OrgId: pulumi.String("1234567890"),
Role: pulumi.String("roles/editor"),
Members: pulumi.StringArray{
pulumi.String("user:jane@example.com"),
},
Condition: &organizations.IAMBindingConditionArgs{
Title: pulumi.String("expires_after_2019_12_31"),
Description: pulumi.String("Expiring at midnight of 2019-12-31"),
Expression: pulumi.String("request.time < timestamp(\"2020-01-01T00:00:00Z\")"),
},
})
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 organization = new Gcp.Organizations.IAMBinding("organization", new()
{
OrgId = "1234567890",
Role = "roles/editor",
Members = new[]
{
"user:jane@example.com",
},
Condition = new Gcp.Organizations.Inputs.IAMBindingConditionArgs
{
Title = "expires_after_2019_12_31",
Description = "Expiring at midnight of 2019-12-31",
Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.IAMBinding;
import com.pulumi.gcp.organizations.IAMBindingArgs;
import com.pulumi.gcp.organizations.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 organization = new IAMBinding("organization", IAMBindingArgs.builder()
.orgId("1234567890")
.role("roles/editor")
.members("user:jane@example.com")
.condition(IAMBindingConditionArgs.builder()
.title("expires_after_2019_12_31")
.description("Expiring at midnight of 2019-12-31")
.expression("request.time < timestamp(\"2020-01-01T00:00:00Z\")")
.build())
.build());
}
}
resources:
organization:
type: gcp:organizations:IAMBinding
properties:
orgId: '1234567890'
role: roles/editor
members:
- user:jane@example.com
condition:
title: expires_after_2019_12_31
description: Expiring at midnight of 2019-12-31
expression: request.time < timestamp("2020-01-01T00:00:00Z")
gcp.organizations.IAMMember
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const organization = new gcp.organizations.IAMMember("organization", {
orgId: "1234567890",
role: "roles/editor",
member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
organization = gcp.organizations.IAMMember("organization",
org_id="1234567890",
role="roles/editor",
member="user:jane@example.com")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewIAMMember(ctx, "organization", &organizations.IAMMemberArgs{
OrgId: pulumi.String("1234567890"),
Role: pulumi.String("roles/editor"),
Member: pulumi.String("user:jane@example.com"),
})
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 organization = new Gcp.Organizations.IAMMember("organization", new()
{
OrgId = "1234567890",
Role = "roles/editor",
Member = "user:jane@example.com",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.IAMMember;
import com.pulumi.gcp.organizations.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 organization = new IAMMember("organization", IAMMemberArgs.builder()
.orgId("1234567890")
.role("roles/editor")
.member("user:jane@example.com")
.build());
}
}
resources:
organization:
type: gcp:organizations:IAMMember
properties:
orgId: '1234567890'
role: roles/editor
member: user:jane@example.com
With IAM Conditions:
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const organization = new gcp.organizations.IAMMember("organization", {
orgId: "1234567890",
role: "roles/editor",
member: "user:jane@example.com",
condition: {
title: "expires_after_2019_12_31",
description: "Expiring at midnight of 2019-12-31",
expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
});
import pulumi
import pulumi_gcp as gcp
organization = gcp.organizations.IAMMember("organization",
org_id="1234567890",
role="roles/editor",
member="user:jane@example.com",
condition=gcp.organizations.IAMMemberConditionArgs(
title="expires_after_2019_12_31",
description="Expiring at midnight of 2019-12-31",
expression="request.time < timestamp(\"2020-01-01T00:00:00Z\")",
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewIAMMember(ctx, "organization", &organizations.IAMMemberArgs{
OrgId: pulumi.String("1234567890"),
Role: pulumi.String("roles/editor"),
Member: pulumi.String("user:jane@example.com"),
Condition: &organizations.IAMMemberConditionArgs{
Title: pulumi.String("expires_after_2019_12_31"),
Description: pulumi.String("Expiring at midnight of 2019-12-31"),
Expression: pulumi.String("request.time < timestamp(\"2020-01-01T00:00:00Z\")"),
},
})
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 organization = new Gcp.Organizations.IAMMember("organization", new()
{
OrgId = "1234567890",
Role = "roles/editor",
Member = "user:jane@example.com",
Condition = new Gcp.Organizations.Inputs.IAMMemberConditionArgs
{
Title = "expires_after_2019_12_31",
Description = "Expiring at midnight of 2019-12-31",
Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.IAMMember;
import com.pulumi.gcp.organizations.IAMMemberArgs;
import com.pulumi.gcp.organizations.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 organization = new IAMMember("organization", IAMMemberArgs.builder()
.orgId("1234567890")
.role("roles/editor")
.member("user:jane@example.com")
.condition(IAMMemberConditionArgs.builder()
.title("expires_after_2019_12_31")
.description("Expiring at midnight of 2019-12-31")
.expression("request.time < timestamp(\"2020-01-01T00:00:00Z\")")
.build())
.build());
}
}
resources:
organization:
type: gcp:organizations:IAMMember
properties:
orgId: '1234567890'
role: roles/editor
member: user:jane@example.com
condition:
title: expires_after_2019_12_31
description: Expiring at midnight of 2019-12-31
expression: request.time < timestamp("2020-01-01T00:00:00Z")
gcp.organizations.IamAuditConfig
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const organization = new gcp.organizations.IamAuditConfig("organization", {
orgId: "1234567890",
service: "allServices",
auditLogConfigs: [
{
logType: "ADMIN_READ",
},
{
logType: "DATA_READ",
exemptedMembers: ["user:joebloggs@example.com"],
},
],
});
import pulumi
import pulumi_gcp as gcp
organization = gcp.organizations.IamAuditConfig("organization",
org_id="1234567890",
service="allServices",
audit_log_configs=[
gcp.organizations.IamAuditConfigAuditLogConfigArgs(
log_type="ADMIN_READ",
),
gcp.organizations.IamAuditConfigAuditLogConfigArgs(
log_type="DATA_READ",
exempted_members=["user:joebloggs@example.com"],
),
])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewIamAuditConfig(ctx, "organization", &organizations.IamAuditConfigArgs{
OrgId: pulumi.String("1234567890"),
Service: pulumi.String("allServices"),
AuditLogConfigs: organizations.IamAuditConfigAuditLogConfigArray{
&organizations.IamAuditConfigAuditLogConfigArgs{
LogType: pulumi.String("ADMIN_READ"),
},
&organizations.IamAuditConfigAuditLogConfigArgs{
LogType: pulumi.String("DATA_READ"),
ExemptedMembers: pulumi.StringArray{
pulumi.String("user:joebloggs@example.com"),
},
},
},
})
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 organization = new Gcp.Organizations.IamAuditConfig("organization", new()
{
OrgId = "1234567890",
Service = "allServices",
AuditLogConfigs = new[]
{
new Gcp.Organizations.Inputs.IamAuditConfigAuditLogConfigArgs
{
LogType = "ADMIN_READ",
},
new Gcp.Organizations.Inputs.IamAuditConfigAuditLogConfigArgs
{
LogType = "DATA_READ",
ExemptedMembers = new[]
{
"user:joebloggs@example.com",
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.IamAuditConfig;
import com.pulumi.gcp.organizations.IamAuditConfigArgs;
import com.pulumi.gcp.organizations.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 organization = new IamAuditConfig("organization", IamAuditConfigArgs.builder()
.orgId("1234567890")
.service("allServices")
.auditLogConfigs(
IamAuditConfigAuditLogConfigArgs.builder()
.logType("ADMIN_READ")
.build(),
IamAuditConfigAuditLogConfigArgs.builder()
.logType("DATA_READ")
.exemptedMembers("user:joebloggs@example.com")
.build())
.build());
}
}
resources:
organization:
type: gcp:organizations:IamAuditConfig
properties:
orgId: '1234567890'
service: allServices
auditLogConfigs:
- logType: ADMIN_READ
- logType: DATA_READ
exemptedMembers:
- user:joebloggs@example.com
Create IAMMember Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new IAMMember(name: string, args: IAMMemberArgs, opts?: CustomResourceOptions);
@overload
def IAMMember(resource_name: str,
args: IAMMemberArgs,
opts: Optional[ResourceOptions] = None)
@overload
def IAMMember(resource_name: str,
opts: Optional[ResourceOptions] = None,
member: Optional[str] = None,
org_id: Optional[str] = None,
role: Optional[str] = None,
condition: Optional[IAMMemberConditionArgs] = 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:organizations:IAMMember
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 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var gcpIAMMemberResource = new Gcp.Organizations.IAMMember("gcpIAMMemberResource", new()
{
Member = "string",
OrgId = "string",
Role = "string",
Condition = new Gcp.Organizations.Inputs.IAMMemberConditionArgs
{
Expression = "string",
Title = "string",
Description = "string",
},
});
example, err := organizations.NewIAMMember(ctx, "gcpIAMMemberResource", &organizations.IAMMemberArgs{
Member: pulumi.String("string"),
OrgId: pulumi.String("string"),
Role: pulumi.String("string"),
Condition: &organizations.IAMMemberConditionArgs{
Expression: pulumi.String("string"),
Title: pulumi.String("string"),
Description: pulumi.String("string"),
},
})
var gcpIAMMemberResource = new IAMMember("gcpIAMMemberResource", IAMMemberArgs.builder()
.member("string")
.orgId("string")
.role("string")
.condition(IAMMemberConditionArgs.builder()
.expression("string")
.title("string")
.description("string")
.build())
.build());
gcp_iam_member_resource = gcp.organizations.IAMMember("gcpIAMMemberResource",
member="string",
org_id="string",
role="string",
condition=gcp.organizations.IAMMemberConditionArgs(
expression="string",
title="string",
description="string",
))
const gcpIAMMemberResource = new gcp.organizations.IAMMember("gcpIAMMemberResource", {
member: "string",
orgId: "string",
role: "string",
condition: {
expression: "string",
title: "string",
description: "string",
},
});
type: gcp:organizations:IAMMember
properties:
condition:
description: string
expression: string
title: string
member: string
orgId: string
role: string
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
- Identities that will be granted the privilege in
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.
- Org
Id string - The organization id of the target organization.
- Role string
- The role that should be applied. Only one
gcp.organizations.IAMBinding
can be used per role. Note that custom roles must be of the formatorganizations/{{org_id}}/roles/{{role_id}}
. - Condition
IAMMember
Condition - An IAM Condition for a given binding. Structure is documented below.
- Member string
- Identities that will be granted the privilege in
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.
- Org
Id string - The organization id of the target organization.
- Role string
- The role that should be applied. Only one
gcp.organizations.IAMBinding
can be used per role. Note that custom roles must be of the formatorganizations/{{org_id}}/roles/{{role_id}}
. - Condition
IAMMember
Condition Args - An IAM Condition for a given binding. Structure is documented below.
- member String
- Identities that will be granted the privilege in
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.
- org
Id String - The organization id of the target organization.
- role String
- The role that should be applied. Only one
gcp.organizations.IAMBinding
can be used per role. Note that custom roles must be of the formatorganizations/{{org_id}}/roles/{{role_id}}
. - condition
IAMMember
Condition - An IAM Condition for a given binding. Structure is documented below.
- member string
- Identities that will be granted the privilege in
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.
- org
Id string - The organization id of the target organization.
- role string
- The role that should be applied. Only one
gcp.organizations.IAMBinding
can be used per role. Note that custom roles must be of the formatorganizations/{{org_id}}/roles/{{role_id}}
. - condition
IAMMember
Condition - An IAM Condition for a given binding. Structure is documented below.
- member str
- Identities that will be granted the privilege in
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.
- org_
id str - The organization id of the target organization.
- role str
- The role that should be applied. Only one
gcp.organizations.IAMBinding
can be used per role. Note that custom roles must be of the formatorganizations/{{org_id}}/roles/{{role_id}}
. - condition
IAMMember
Condition Args - An IAM Condition for a given binding. Structure is documented below.
- member String
- Identities that will be granted the privilege in
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.
- org
Id String - The organization id of the target organization.
- role String
- The role that should be applied. Only one
gcp.organizations.IAMBinding
can be used per role. Note that custom roles must be of the formatorganizations/{{org_id}}/roles/{{role_id}}
. - 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:
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,
org_id: 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.
- Condition
IAMMember
Condition - An IAM Condition for a given binding. Structure is documented below.
- Etag string
- (Computed) The etag of the organization's IAM policy.
- Member string
- Identities that will be granted the privilege in
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.
- Org
Id string - The organization id of the target organization.
- Role string
- The role that should be applied. Only one
gcp.organizations.IAMBinding
can be used per role. Note that custom roles must be of the formatorganizations/{{org_id}}/roles/{{role_id}}
.
- Condition
IAMMember
Condition Args - An IAM Condition for a given binding. Structure is documented below.
- Etag string
- (Computed) The etag of the organization's IAM policy.
- Member string
- Identities that will be granted the privilege in
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.
- Org
Id string - The organization id of the target organization.
- Role string
- The role that should be applied. Only one
gcp.organizations.IAMBinding
can be used per role. Note that custom roles must be of the formatorganizations/{{org_id}}/roles/{{role_id}}
.
- condition
IAMMember
Condition - An IAM Condition for a given binding. Structure is documented below.
- etag String
- (Computed) The etag of the organization's IAM policy.
- member String
- Identities that will be granted the privilege in
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.
- org
Id String - The organization id of the target organization.
- role String
- The role that should be applied. Only one
gcp.organizations.IAMBinding
can be used per role. Note that custom roles must be of the formatorganizations/{{org_id}}/roles/{{role_id}}
.
- condition
IAMMember
Condition - An IAM Condition for a given binding. Structure is documented below.
- etag string
- (Computed) The etag of the organization's IAM policy.
- member string
- Identities that will be granted the privilege in
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.
- org
Id string - The organization id of the target organization.
- role string
- The role that should be applied. Only one
gcp.organizations.IAMBinding
can be used per role. Note that custom roles must be of the formatorganizations/{{org_id}}/roles/{{role_id}}
.
- condition
IAMMember
Condition Args - An IAM Condition for a given binding. Structure is documented below.
- etag str
- (Computed) The etag of the organization's IAM policy.
- member str
- Identities that will be granted the privilege in
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.
- org_
id str - The organization id of the target organization.
- role str
- The role that should be applied. Only one
gcp.organizations.IAMBinding
can be used per role. Note that custom roles must be of the formatorganizations/{{org_id}}/roles/{{role_id}}
.
- condition Property Map
- An IAM Condition for a given binding. Structure is documented below.
- etag String
- (Computed) The etag of the organization's IAM policy.
- member String
- Identities that will be granted the privilege in
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.
- org
Id String - The organization id of the target organization.
- role String
- The role that should be applied. Only one
gcp.organizations.IAMBinding
can be used per role. Note that custom roles must be of the formatorganizations/{{org_id}}/roles/{{role_id}}
.
Supporting Types
IAMMemberCondition, IAMMemberConditionArgs
- 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
Importing Audit Configs
An audit config can be imported into a google_organization_iam_audit_config
resource using the resource’s org_id
and the service
, e.g:
"{{org_id}} foo.googleapis.com"
An import
block (Terraform v1.5.0 and later) can be used to import audit configs:
tf
import {
id = “{{org_id}} foo.googleapis.com”
to = google_organization_iam_audit_config.default
}
The pulumi import
command can also be used:
$ pulumi import gcp:organizations/iAMMember:IAMMember default "{{org_id}} foo.googleapis.com"
To learn more about importing existing cloud resources, see Importing resources.
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.