gcp logo
Google Cloud Classic v6.56.0, May 18 23

gcp.folder.IamAuditConfig

Explore with Pulumi AI

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

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

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

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

Note: The underlying API method projects.setIamPolicy has 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 a 400 error code so please review these if you encounter errors with this resource.

google_folder_iam_policy

!> Be careful! You can accidentally lock yourself out of your folder using this resource. Deleting a gcp.folder.IAMPolicy removes access from anyone without permissions on its parent folder/organization. Proceed with caution. It’s not recommended to use gcp.folder.IAMPolicy with your provider folder to avoid locking yourself out, and it should generally only be used with folders 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 folder = new gcp.folder.IAMPolicy("folder", {
    folder: "folders/1234567",
    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"],
)])
folder = gcp.folder.IAMPolicy("folder",
    folder="folders/1234567",
    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 folder = new Gcp.Folder.IAMPolicy("folder", new()
    {
        Folder = "folders/1234567",
        PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/folder"
	"github.com/pulumi/pulumi-gcp/sdk/v6/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 = folder.NewIAMPolicy(ctx, "folder", &folder.IAMPolicyArgs{
			Folder:     pulumi.String("folders/1234567"),
			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.folder.IAMPolicy;
import com.pulumi.gcp.folder.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 folder = new IAMPolicy("folder", IAMPolicyArgs.builder()        
            .folder("folders/1234567")
            .policyData(admin.applyValue(getIAMPolicyResult -> getIAMPolicyResult.policyData()))
            .build());

    }
}
resources:
  folder:
    type: gcp:folder:IAMPolicy
    properties:
      folder: folders/1234567
      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 folder = new gcp.folder.IAMPolicy("folder", {
    folder: "folders/1234567",
    policyData: admin.then(admin => admin.policyData),
});
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",
)])
folder = gcp.folder.IAMPolicy("folder",
    folder="folders/1234567",
    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
            {
                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 folder = new Gcp.Folder.IAMPolicy("folder", new()
    {
        Folder = "folders/1234567",
        PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/folder"
	"github.com/pulumi/pulumi-gcp/sdk/v6/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{
				{
					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 = folder.NewIAMPolicy(ctx, "folder", &folder.IAMPolicyArgs{
			Folder:     pulumi.String("folders/1234567"),
			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.folder.IAMPolicy;
import com.pulumi.gcp.folder.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 folder = new IAMPolicy("folder", IAMPolicyArgs.builder()        
            .folder("folders/1234567")
            .policyData(admin.applyValue(getIAMPolicyResult -> getIAMPolicyResult.policyData()))
            .build());

    }
}
resources:
  folder:
    type: gcp:folder:IAMPolicy
    properties:
      folder: folders/1234567
      policyData: ${admin.policyData}
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_folder_iam_binding

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const folder = new gcp.folder.IAMBinding("folder", {
    folder: "folders/1234567",
    members: ["user:jane@example.com"],
    role: "roles/editor",
});
import pulumi
import pulumi_gcp as gcp

folder = gcp.folder.IAMBinding("folder",
    folder="folders/1234567",
    members=["user:jane@example.com"],
    role="roles/editor")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var folder = new Gcp.Folder.IAMBinding("folder", new()
    {
        Folder = "folders/1234567",
        Members = new[]
        {
            "user:jane@example.com",
        },
        Role = "roles/editor",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/folder"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := folder.NewIAMBinding(ctx, "folder", &folder.IAMBindingArgs{
			Folder: pulumi.String("folders/1234567"),
			Members: pulumi.StringArray{
				pulumi.String("user:jane@example.com"),
			},
			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.folder.IAMBinding;
import com.pulumi.gcp.folder.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 folder = new IAMBinding("folder", IAMBindingArgs.builder()        
            .folder("folders/1234567")
            .members("user:jane@example.com")
            .role("roles/editor")
            .build());

    }
}
resources:
  folder:
    type: gcp:folder:IAMBinding
    properties:
      folder: folders/1234567
      members:
        - user:jane@example.com
      role: roles/editor

With IAM Conditions:

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const folder = new gcp.folder.IAMBinding("folder", {
    condition: {
        description: "Expiring at midnight of 2019-12-31",
        expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
        title: "expires_after_2019_12_31",
    },
    folder: "folders/1234567",
    members: ["user:jane@example.com"],
    role: "roles/container.admin",
});
import pulumi
import pulumi_gcp as gcp

folder = gcp.folder.IAMBinding("folder",
    condition=gcp.folder.IAMBindingConditionArgs(
        description="Expiring at midnight of 2019-12-31",
        expression="request.time < timestamp(\"2020-01-01T00:00:00Z\")",
        title="expires_after_2019_12_31",
    ),
    folder="folders/1234567",
    members=["user:jane@example.com"],
    role="roles/container.admin")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var folder = new Gcp.Folder.IAMBinding("folder", new()
    {
        Condition = new Gcp.Folder.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",
        },
        Folder = "folders/1234567",
        Members = new[]
        {
            "user:jane@example.com",
        },
        Role = "roles/container.admin",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/folder"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := folder.NewIAMBinding(ctx, "folder", &folder.IAMBindingArgs{
			Condition: &folder.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"),
			},
			Folder: pulumi.String("folders/1234567"),
			Members: pulumi.StringArray{
				pulumi.String("user:jane@example.com"),
			},
			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.folder.IAMBinding;
import com.pulumi.gcp.folder.IAMBindingArgs;
import com.pulumi.gcp.folder.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 folder = new IAMBinding("folder", 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())
            .folder("folders/1234567")
            .members("user:jane@example.com")
            .role("roles/container.admin")
            .build());

    }
}
resources:
  folder:
    type: gcp:folder: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
      folder: folders/1234567
      members:
        - user:jane@example.com
      role: roles/container.admin

google_folder_iam_member

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const folder = new gcp.folder.IAMMember("folder", {
    folder: "folders/1234567",
    member: "user:jane@example.com",
    role: "roles/editor",
});
import pulumi
import pulumi_gcp as gcp

folder = gcp.folder.IAMMember("folder",
    folder="folders/1234567",
    member="user:jane@example.com",
    role="roles/editor")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var folder = new Gcp.Folder.IAMMember("folder", new()
    {
        Folder = "folders/1234567",
        Member = "user:jane@example.com",
        Role = "roles/editor",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/folder"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := folder.NewIAMMember(ctx, "folder", &folder.IAMMemberArgs{
			Folder: pulumi.String("folders/1234567"),
			Member: pulumi.String("user:jane@example.com"),
			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.folder.IAMMember;
import com.pulumi.gcp.folder.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 folder = new IAMMember("folder", IAMMemberArgs.builder()        
            .folder("folders/1234567")
            .member("user:jane@example.com")
            .role("roles/editor")
            .build());

    }
}
resources:
  folder:
    type: gcp:folder:IAMMember
    properties:
      folder: folders/1234567
      member: user:jane@example.com
      role: roles/editor

With IAM Conditions:

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const folder = new gcp.folder.IAMMember("folder", {
    condition: {
        description: "Expiring at midnight of 2019-12-31",
        expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
        title: "expires_after_2019_12_31",
    },
    folder: "folders/1234567",
    member: "user:jane@example.com",
    role: "roles/firebase.admin",
});
import pulumi
import pulumi_gcp as gcp

folder = gcp.folder.IAMMember("folder",
    condition=gcp.folder.IAMMemberConditionArgs(
        description="Expiring at midnight of 2019-12-31",
        expression="request.time < timestamp(\"2020-01-01T00:00:00Z\")",
        title="expires_after_2019_12_31",
    ),
    folder="folders/1234567",
    member="user:jane@example.com",
    role="roles/firebase.admin")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var folder = new Gcp.Folder.IAMMember("folder", new()
    {
        Condition = new Gcp.Folder.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",
        },
        Folder = "folders/1234567",
        Member = "user:jane@example.com",
        Role = "roles/firebase.admin",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/folder"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := folder.NewIAMMember(ctx, "folder", &folder.IAMMemberArgs{
			Condition: &folder.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"),
			},
			Folder: pulumi.String("folders/1234567"),
			Member: pulumi.String("user:jane@example.com"),
			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.folder.IAMMember;
import com.pulumi.gcp.folder.IAMMemberArgs;
import com.pulumi.gcp.folder.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 folder = new IAMMember("folder", 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())
            .folder("folders/1234567")
            .member("user:jane@example.com")
            .role("roles/firebase.admin")
            .build());

    }
}
resources:
  folder:
    type: gcp:folder: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
      folder: folders/1234567
      member: user:jane@example.com
      role: roles/firebase.admin

google_folder_iam_audit_config

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const folder = new gcp.folder.IamAuditConfig("folder", {
    auditLogConfigs: [
        {
            logType: "ADMIN_READ",
        },
        {
            exemptedMembers: ["user:joebloggs@hashicorp.com"],
            logType: "DATA_READ",
        },
    ],
    folder: "folders/1234567",
    service: "allServices",
});
import pulumi
import pulumi_gcp as gcp

folder = gcp.folder.IamAuditConfig("folder",
    audit_log_configs=[
        gcp.folder.IamAuditConfigAuditLogConfigArgs(
            log_type="ADMIN_READ",
        ),
        gcp.folder.IamAuditConfigAuditLogConfigArgs(
            exempted_members=["user:joebloggs@hashicorp.com"],
            log_type="DATA_READ",
        ),
    ],
    folder="folders/1234567",
    service="allServices")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var folder = new Gcp.Folder.IamAuditConfig("folder", new()
    {
        AuditLogConfigs = new[]
        {
            new Gcp.Folder.Inputs.IamAuditConfigAuditLogConfigArgs
            {
                LogType = "ADMIN_READ",
            },
            new Gcp.Folder.Inputs.IamAuditConfigAuditLogConfigArgs
            {
                ExemptedMembers = new[]
                {
                    "user:joebloggs@hashicorp.com",
                },
                LogType = "DATA_READ",
            },
        },
        Folder = "folders/1234567",
        Service = "allServices",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/folder"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := folder.NewIamAuditConfig(ctx, "folder", &folder.IamAuditConfigArgs{
			AuditLogConfigs: folder.IamAuditConfigAuditLogConfigArray{
				&folder.IamAuditConfigAuditLogConfigArgs{
					LogType: pulumi.String("ADMIN_READ"),
				},
				&folder.IamAuditConfigAuditLogConfigArgs{
					ExemptedMembers: pulumi.StringArray{
						pulumi.String("user:joebloggs@hashicorp.com"),
					},
					LogType: pulumi.String("DATA_READ"),
				},
			},
			Folder:  pulumi.String("folders/1234567"),
			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.folder.IamAuditConfig;
import com.pulumi.gcp.folder.IamAuditConfigArgs;
import com.pulumi.gcp.folder.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 folder = new IamAuditConfig("folder", IamAuditConfigArgs.builder()        
            .auditLogConfigs(            
                IamAuditConfigAuditLogConfigArgs.builder()
                    .logType("ADMIN_READ")
                    .build(),
                IamAuditConfigAuditLogConfigArgs.builder()
                    .exemptedMembers("user:joebloggs@hashicorp.com")
                    .logType("DATA_READ")
                    .build())
            .folder("folders/1234567")
            .service("allServices")
            .build());

    }
}
resources:
  folder:
    type: gcp:folder:IamAuditConfig
    properties:
      auditLogConfigs:
        - logType: ADMIN_READ
        - exemptedMembers:
            - user:joebloggs@hashicorp.com
          logType: DATA_READ
      folder: folders/1234567
      service: allServices

Create IamAuditConfig Resource

new IamAuditConfig(name: string, args: IamAuditConfigArgs, opts?: CustomResourceOptions);
@overload
def IamAuditConfig(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   audit_log_configs: Optional[Sequence[IamAuditConfigAuditLogConfigArgs]] = None,
                   folder: Optional[str] = None,
                   service: Optional[str] = None)
@overload
def IamAuditConfig(resource_name: str,
                   args: IamAuditConfigArgs,
                   opts: Optional[ResourceOptions] = None)
func NewIamAuditConfig(ctx *Context, name string, args IamAuditConfigArgs, opts ...ResourceOption) (*IamAuditConfig, error)
public IamAuditConfig(string name, IamAuditConfigArgs args, CustomResourceOptions? opts = null)
public IamAuditConfig(String name, IamAuditConfigArgs args)
public IamAuditConfig(String name, IamAuditConfigArgs args, CustomResourceOptions options)
type: gcp:folder:IamAuditConfig
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args IamAuditConfigArgs
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 IamAuditConfigArgs
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 IamAuditConfigArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args IamAuditConfigArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args IamAuditConfigArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

IamAuditConfig 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 IamAuditConfig resource accepts the following input properties:

AuditLogConfigs List<IamAuditConfigAuditLogConfigArgs>

The configuration for logging of each type of permission. This can be specified multiple times. Structure is documented below.

Folder string

The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.

Service string

Service which will be enabled for audit logging. The special value allServices covers all services. Note that if there are google_folder_iam_audit_config resources covering both allServices and a specific service then the union of the two AuditConfigs is used for that service: the log_types specified in each audit_log_config are enabled, and the exempted_members in each audit_log_config are exempted.

AuditLogConfigs []IamAuditConfigAuditLogConfigArgs

The configuration for logging of each type of permission. This can be specified multiple times. Structure is documented below.

Folder string

The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.

Service string

Service which will be enabled for audit logging. The special value allServices covers all services. Note that if there are google_folder_iam_audit_config resources covering both allServices and a specific service then the union of the two AuditConfigs is used for that service: the log_types specified in each audit_log_config are enabled, and the exempted_members in each audit_log_config are exempted.

auditLogConfigs List<IamAuditConfigAuditLogConfigArgs>

The configuration for logging of each type of permission. This can be specified multiple times. Structure is documented below.

folder String

The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.

service String

Service which will be enabled for audit logging. The special value allServices covers all services. Note that if there are google_folder_iam_audit_config resources covering both allServices and a specific service then the union of the two AuditConfigs is used for that service: the log_types specified in each audit_log_config are enabled, and the exempted_members in each audit_log_config are exempted.

auditLogConfigs IamAuditConfigAuditLogConfigArgs[]

The configuration for logging of each type of permission. This can be specified multiple times. Structure is documented below.

folder string

The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.

service string

Service which will be enabled for audit logging. The special value allServices covers all services. Note that if there are google_folder_iam_audit_config resources covering both allServices and a specific service then the union of the two AuditConfigs is used for that service: the log_types specified in each audit_log_config are enabled, and the exempted_members in each audit_log_config are exempted.

audit_log_configs Sequence[IamAuditConfigAuditLogConfigArgs]

The configuration for logging of each type of permission. This can be specified multiple times. Structure is documented below.

folder str

The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.

service str

Service which will be enabled for audit logging. The special value allServices covers all services. Note that if there are google_folder_iam_audit_config resources covering both allServices and a specific service then the union of the two AuditConfigs is used for that service: the log_types specified in each audit_log_config are enabled, and the exempted_members in each audit_log_config are exempted.

auditLogConfigs List<Property Map>

The configuration for logging of each type of permission. This can be specified multiple times. Structure is documented below.

folder String

The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.

service String

Service which will be enabled for audit logging. The special value allServices covers all services. Note that if there are google_folder_iam_audit_config resources covering both allServices and a specific service then the union of the two AuditConfigs is used for that service: the log_types specified in each audit_log_config are enabled, and the exempted_members in each audit_log_config are exempted.

Outputs

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

Etag string

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

Id string

The provider-assigned unique ID for this managed resource.

Etag string

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

Id string

The provider-assigned unique ID for this managed resource.

etag String

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

id String

The provider-assigned unique ID for this managed resource.

etag string

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

id string

The provider-assigned unique ID for this managed resource.

etag str

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

id str

The provider-assigned unique ID for this managed resource.

etag String

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

id String

The provider-assigned unique ID for this managed resource.

Look up Existing IamAuditConfig Resource

Get an existing IamAuditConfig 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?: IamAuditConfigState, opts?: CustomResourceOptions): IamAuditConfig
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        audit_log_configs: Optional[Sequence[IamAuditConfigAuditLogConfigArgs]] = None,
        etag: Optional[str] = None,
        folder: Optional[str] = None,
        service: Optional[str] = None) -> IamAuditConfig
func GetIamAuditConfig(ctx *Context, name string, id IDInput, state *IamAuditConfigState, opts ...ResourceOption) (*IamAuditConfig, error)
public static IamAuditConfig Get(string name, Input<string> id, IamAuditConfigState? state, CustomResourceOptions? opts = null)
public static IamAuditConfig get(String name, Output<String> id, IamAuditConfigState 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:
AuditLogConfigs List<IamAuditConfigAuditLogConfigArgs>

The configuration for logging of each type of permission. This can be specified multiple times. Structure is documented below.

Etag string

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

Folder string

The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.

Service string

Service which will be enabled for audit logging. The special value allServices covers all services. Note that if there are google_folder_iam_audit_config resources covering both allServices and a specific service then the union of the two AuditConfigs is used for that service: the log_types specified in each audit_log_config are enabled, and the exempted_members in each audit_log_config are exempted.

AuditLogConfigs []IamAuditConfigAuditLogConfigArgs

The configuration for logging of each type of permission. This can be specified multiple times. Structure is documented below.

Etag string

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

Folder string

The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.

Service string

Service which will be enabled for audit logging. The special value allServices covers all services. Note that if there are google_folder_iam_audit_config resources covering both allServices and a specific service then the union of the two AuditConfigs is used for that service: the log_types specified in each audit_log_config are enabled, and the exempted_members in each audit_log_config are exempted.

auditLogConfigs List<IamAuditConfigAuditLogConfigArgs>

The configuration for logging of each type of permission. This can be specified multiple times. Structure is documented below.

etag String

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

folder String

The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.

service String

Service which will be enabled for audit logging. The special value allServices covers all services. Note that if there are google_folder_iam_audit_config resources covering both allServices and a specific service then the union of the two AuditConfigs is used for that service: the log_types specified in each audit_log_config are enabled, and the exempted_members in each audit_log_config are exempted.

auditLogConfigs IamAuditConfigAuditLogConfigArgs[]

The configuration for logging of each type of permission. This can be specified multiple times. Structure is documented below.

etag string

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

folder string

The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.

service string

Service which will be enabled for audit logging. The special value allServices covers all services. Note that if there are google_folder_iam_audit_config resources covering both allServices and a specific service then the union of the two AuditConfigs is used for that service: the log_types specified in each audit_log_config are enabled, and the exempted_members in each audit_log_config are exempted.

audit_log_configs Sequence[IamAuditConfigAuditLogConfigArgs]

The configuration for logging of each type of permission. This can be specified multiple times. Structure is documented below.

etag str

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

folder str

The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.

service str

Service which will be enabled for audit logging. The special value allServices covers all services. Note that if there are google_folder_iam_audit_config resources covering both allServices and a specific service then the union of the two AuditConfigs is used for that service: the log_types specified in each audit_log_config are enabled, and the exempted_members in each audit_log_config are exempted.

auditLogConfigs List<Property Map>

The configuration for logging of each type of permission. This can be specified multiple times. Structure is documented below.

etag String

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

folder String

The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.

service String

Service which will be enabled for audit logging. The special value allServices covers all services. Note that if there are google_folder_iam_audit_config resources covering both allServices and a specific service then the union of the two AuditConfigs is used for that service: the log_types specified in each audit_log_config are enabled, and the exempted_members in each audit_log_config are exempted.

Supporting Types

IamAuditConfigAuditLogConfig

LogType string

Permission type for which logging is to be configured. Must be one of DATA_READ, DATA_WRITE, or ADMIN_READ.

ExemptedMembers List<string>

Identities that do not cause logging for this type of permission. The format is the same as that for members.

LogType string

Permission type for which logging is to be configured. Must be one of DATA_READ, DATA_WRITE, or ADMIN_READ.

ExemptedMembers []string

Identities that do not cause logging for this type of permission. The format is the same as that for members.

logType String

Permission type for which logging is to be configured. Must be one of DATA_READ, DATA_WRITE, or ADMIN_READ.

exemptedMembers List<String>

Identities that do not cause logging for this type of permission. The format is the same as that for members.

logType string

Permission type for which logging is to be configured. Must be one of DATA_READ, DATA_WRITE, or ADMIN_READ.

exemptedMembers string[]

Identities that do not cause logging for this type of permission. The format is the same as that for members.

log_type str

Permission type for which logging is to be configured. Must be one of DATA_READ, DATA_WRITE, or ADMIN_READ.

exempted_members Sequence[str]

Identities that do not cause logging for this type of permission. The format is the same as that for members.

logType String

Permission type for which logging is to be configured. Must be one of DATA_READ, DATA_WRITE, or ADMIN_READ.

exemptedMembers List<String>

Identities that do not cause logging for this type of permission. The format is the same as that for members.

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 folder, role, and member e.g.

 $ pulumi import gcp:folder/iamAuditConfig:IamAuditConfig my_folder "folder 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 folder and role, e.g.

 $ pulumi import gcp:folder/iamAuditConfig:IamAuditConfig my_folder "folder roles/viewer"

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

This policy resource can be imported using the folder.

 $ pulumi import gcp:folder/iamAuditConfig:IamAuditConfig my_folder folder

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

 $ pulumi import gcp:folder/iamAuditConfig:IamAuditConfig my_folder "folder 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. organizations/{{org_id}}/roles/{{role_id}}. -> Conditional IAM BindingsIf you’re importing a IAM binding with a condition block, make sure

 $ pulumi import gcp:folder/iamAuditConfig:IamAuditConfig to include the title of condition, e.g. `google_folder_iam_binding.my_folder "folder 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.