1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. kms
  5. KeyRingIAMPolicy
Google Cloud Classic v6.58.0 published on Tuesday, Jun 6, 2023 by Pulumi

gcp.kms.KeyRingIAMPolicy

Explore with Pulumi AI

gcp logo
Google Cloud Classic v6.58.0 published on Tuesday, Jun 6, 2023 by Pulumi

    Three different resources help you manage your IAM policy for KMS key ring. Each of these resources serves a different use case:

    • gcp.kms.KeyRingIAMPolicy: Authoritative. Sets the IAM policy for the key ring and replaces any existing policy already attached.
    • gcp.kms.KeyRingIAMBinding: 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 key ring are preserved.
    • gcp.kms.KeyRingIAMMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the key ring are preserved.

    Note: gcp.kms.KeyRingIAMPolicy cannot be used in conjunction with gcp.kms.KeyRingIAMBinding and gcp.kms.KeyRingIAMMember or they will fight over what your policy should be.

    Note: gcp.kms.KeyRingIAMBinding resources can be used in conjunction with gcp.kms.KeyRingIAMMember resources only if they do not grant privilege to the same role.

    google_kms_key_ring_iam_policy

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const keyring = new gcp.kms.KeyRing("keyring", {location: "global"});
    const admin = gcp.organizations.getIAMPolicy({
        bindings: [{
            role: "roles/editor",
            members: ["user:jane@example.com"],
        }],
    });
    const keyRing = new gcp.kms.KeyRingIAMPolicy("keyRing", {
        keyRingId: keyring.id,
        policyData: admin.then(admin => admin.policyData),
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    keyring = gcp.kms.KeyRing("keyring", location="global")
    admin = gcp.organizations.get_iam_policy(bindings=[gcp.organizations.GetIAMPolicyBindingArgs(
        role="roles/editor",
        members=["user:jane@example.com"],
    )])
    key_ring = gcp.kms.KeyRingIAMPolicy("keyRing",
        key_ring_id=keyring.id,
        policy_data=admin.policy_data)
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var keyring = new Gcp.Kms.KeyRing("keyring", new()
        {
            Location = "global",
        });
    
        var admin = Gcp.Organizations.GetIAMPolicy.Invoke(new()
        {
            Bindings = new[]
            {
                new Gcp.Organizations.Inputs.GetIAMPolicyBindingInputArgs
                {
                    Role = "roles/editor",
                    Members = new[]
                    {
                        "user:jane@example.com",
                    },
                },
            },
        });
    
        var keyRing = new Gcp.Kms.KeyRingIAMPolicy("keyRing", new()
        {
            KeyRingId = keyring.Id,
            PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/kms"
    	"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 {
    		keyring, err := kms.NewKeyRing(ctx, "keyring", &kms.KeyRingArgs{
    			Location: pulumi.String("global"),
    		})
    		if err != nil {
    			return err
    		}
    		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 = kms.NewKeyRingIAMPolicy(ctx, "keyRing", &kms.KeyRingIAMPolicyArgs{
    			KeyRingId:  keyring.ID(),
    			PolicyData: *pulumi.String(admin.PolicyData),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.kms.KeyRing;
    import com.pulumi.gcp.kms.KeyRingArgs;
    import com.pulumi.gcp.organizations.OrganizationsFunctions;
    import com.pulumi.gcp.organizations.inputs.GetIAMPolicyArgs;
    import com.pulumi.gcp.kms.KeyRingIAMPolicy;
    import com.pulumi.gcp.kms.KeyRingIAMPolicyArgs;
    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 keyring = new KeyRing("keyring", KeyRingArgs.builder()        
                .location("global")
                .build());
    
            final var admin = OrganizationsFunctions.getIAMPolicy(GetIAMPolicyArgs.builder()
                .bindings(GetIAMPolicyBindingArgs.builder()
                    .role("roles/editor")
                    .members("user:jane@example.com")
                    .build())
                .build());
    
            var keyRing = new KeyRingIAMPolicy("keyRing", KeyRingIAMPolicyArgs.builder()        
                .keyRingId(keyring.id())
                .policyData(admin.applyValue(getIAMPolicyResult -> getIAMPolicyResult.policyData()))
                .build());
    
        }
    }
    
    resources:
      keyring:
        type: gcp:kms:KeyRing
        properties:
          location: global
      keyRing:
        type: gcp:kms:KeyRingIAMPolicy
        properties:
          keyRingId: ${keyring.id}
          policyData: ${admin.policyData}
    variables:
      admin:
        fn::invoke:
          Function: gcp:organizations:getIAMPolicy
          Arguments:
            bindings:
              - role: roles/editor
                members:
                  - user:jane@example.com
    

    With IAM Conditions:

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const keyring = new gcp.kms.KeyRing("keyring", {location: "global"});
    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 keyRing = new gcp.kms.KeyRingIAMPolicy("keyRing", {
        keyRingId: keyring.id,
        policyData: admin.then(admin => admin.policyData),
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    keyring = gcp.kms.KeyRing("keyring", location="global")
    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\")",
        ),
    )])
    key_ring = gcp.kms.KeyRingIAMPolicy("keyRing",
        key_ring_id=keyring.id,
        policy_data=admin.policy_data)
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var keyring = new Gcp.Kms.KeyRing("keyring", new()
        {
            Location = "global",
        });
    
        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 keyRing = new Gcp.Kms.KeyRingIAMPolicy("keyRing", new()
        {
            KeyRingId = keyring.Id,
            PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/kms"
    	"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 {
    		keyring, err := kms.NewKeyRing(ctx, "keyring", &kms.KeyRingArgs{
    			Location: pulumi.String("global"),
    		})
    		if err != nil {
    			return err
    		}
    		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 = kms.NewKeyRingIAMPolicy(ctx, "keyRing", &kms.KeyRingIAMPolicyArgs{
    			KeyRingId:  keyring.ID(),
    			PolicyData: *pulumi.String(admin.PolicyData),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.kms.KeyRing;
    import com.pulumi.gcp.kms.KeyRingArgs;
    import com.pulumi.gcp.organizations.OrganizationsFunctions;
    import com.pulumi.gcp.organizations.inputs.GetIAMPolicyArgs;
    import com.pulumi.gcp.kms.KeyRingIAMPolicy;
    import com.pulumi.gcp.kms.KeyRingIAMPolicyArgs;
    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 keyring = new KeyRing("keyring", KeyRingArgs.builder()        
                .location("global")
                .build());
    
            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 keyRing = new KeyRingIAMPolicy("keyRing", KeyRingIAMPolicyArgs.builder()        
                .keyRingId(keyring.id())
                .policyData(admin.applyValue(getIAMPolicyResult -> getIAMPolicyResult.policyData()))
                .build());
    
        }
    }
    
    resources:
      keyring:
        type: gcp:kms:KeyRing
        properties:
          location: global
      keyRing:
        type: gcp:kms:KeyRingIAMPolicy
        properties:
          keyRingId: ${keyring.id}
          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")
    

    google_kms_key_ring_iam_binding

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const keyRing = new gcp.kms.KeyRingIAMBinding("keyRing", {
        keyRingId: "your-key-ring-id",
        members: ["user:jane@example.com"],
        role: "roles/cloudkms.admin",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    key_ring = gcp.kms.KeyRingIAMBinding("keyRing",
        key_ring_id="your-key-ring-id",
        members=["user:jane@example.com"],
        role="roles/cloudkms.admin")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var keyRing = new Gcp.Kms.KeyRingIAMBinding("keyRing", new()
        {
            KeyRingId = "your-key-ring-id",
            Members = new[]
            {
                "user:jane@example.com",
            },
            Role = "roles/cloudkms.admin",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/kms"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := kms.NewKeyRingIAMBinding(ctx, "keyRing", &kms.KeyRingIAMBindingArgs{
    			KeyRingId: pulumi.String("your-key-ring-id"),
    			Members: pulumi.StringArray{
    				pulumi.String("user:jane@example.com"),
    			},
    			Role: pulumi.String("roles/cloudkms.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.kms.KeyRingIAMBinding;
    import com.pulumi.gcp.kms.KeyRingIAMBindingArgs;
    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 keyRing = new KeyRingIAMBinding("keyRing", KeyRingIAMBindingArgs.builder()        
                .keyRingId("your-key-ring-id")
                .members("user:jane@example.com")
                .role("roles/cloudkms.admin")
                .build());
    
        }
    }
    
    resources:
      keyRing:
        type: gcp:kms:KeyRingIAMBinding
        properties:
          keyRingId: your-key-ring-id
          members:
            - user:jane@example.com
          role: roles/cloudkms.admin
    

    With IAM Conditions:

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const keyRing = new gcp.kms.KeyRingIAMBinding("keyRing", {
        condition: {
            description: "Expiring at midnight of 2019-12-31",
            expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
            title: "expires_after_2019_12_31",
        },
        keyRingId: "your-key-ring-id",
        members: ["user:jane@example.com"],
        role: "roles/cloudkms.admin",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    key_ring = gcp.kms.KeyRingIAMBinding("keyRing",
        condition=gcp.kms.KeyRingIAMBindingConditionArgs(
            description="Expiring at midnight of 2019-12-31",
            expression="request.time < timestamp(\"2020-01-01T00:00:00Z\")",
            title="expires_after_2019_12_31",
        ),
        key_ring_id="your-key-ring-id",
        members=["user:jane@example.com"],
        role="roles/cloudkms.admin")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var keyRing = new Gcp.Kms.KeyRingIAMBinding("keyRing", new()
        {
            Condition = new Gcp.Kms.Inputs.KeyRingIAMBindingConditionArgs
            {
                Description = "Expiring at midnight of 2019-12-31",
                Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
                Title = "expires_after_2019_12_31",
            },
            KeyRingId = "your-key-ring-id",
            Members = new[]
            {
                "user:jane@example.com",
            },
            Role = "roles/cloudkms.admin",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/kms"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := kms.NewKeyRingIAMBinding(ctx, "keyRing", &kms.KeyRingIAMBindingArgs{
    			Condition: &kms.KeyRingIAMBindingConditionArgs{
    				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"),
    			},
    			KeyRingId: pulumi.String("your-key-ring-id"),
    			Members: pulumi.StringArray{
    				pulumi.String("user:jane@example.com"),
    			},
    			Role: pulumi.String("roles/cloudkms.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.kms.KeyRingIAMBinding;
    import com.pulumi.gcp.kms.KeyRingIAMBindingArgs;
    import com.pulumi.gcp.kms.inputs.KeyRingIAMBindingConditionArgs;
    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 keyRing = new KeyRingIAMBinding("keyRing", KeyRingIAMBindingArgs.builder()        
                .condition(KeyRingIAMBindingConditionArgs.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())
                .keyRingId("your-key-ring-id")
                .members("user:jane@example.com")
                .role("roles/cloudkms.admin")
                .build());
    
        }
    }
    
    resources:
      keyRing:
        type: gcp:kms:KeyRingIAMBinding
        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
          keyRingId: your-key-ring-id
          members:
            - user:jane@example.com
          role: roles/cloudkms.admin
    

    google_kms_key_ring_iam_member

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const keyRing = new gcp.kms.KeyRingIAMMember("keyRing", {
        keyRingId: "your-key-ring-id",
        member: "user:jane@example.com",
        role: "roles/cloudkms.admin",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    key_ring = gcp.kms.KeyRingIAMMember("keyRing",
        key_ring_id="your-key-ring-id",
        member="user:jane@example.com",
        role="roles/cloudkms.admin")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var keyRing = new Gcp.Kms.KeyRingIAMMember("keyRing", new()
        {
            KeyRingId = "your-key-ring-id",
            Member = "user:jane@example.com",
            Role = "roles/cloudkms.admin",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/kms"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := kms.NewKeyRingIAMMember(ctx, "keyRing", &kms.KeyRingIAMMemberArgs{
    			KeyRingId: pulumi.String("your-key-ring-id"),
    			Member:    pulumi.String("user:jane@example.com"),
    			Role:      pulumi.String("roles/cloudkms.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.kms.KeyRingIAMMember;
    import com.pulumi.gcp.kms.KeyRingIAMMemberArgs;
    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 keyRing = new KeyRingIAMMember("keyRing", KeyRingIAMMemberArgs.builder()        
                .keyRingId("your-key-ring-id")
                .member("user:jane@example.com")
                .role("roles/cloudkms.admin")
                .build());
    
        }
    }
    
    resources:
      keyRing:
        type: gcp:kms:KeyRingIAMMember
        properties:
          keyRingId: your-key-ring-id
          member: user:jane@example.com
          role: roles/cloudkms.admin
    

    With IAM Conditions:

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const keyRing = new gcp.kms.KeyRingIAMMember("keyRing", {
        condition: {
            description: "Expiring at midnight of 2019-12-31",
            expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
            title: "expires_after_2019_12_31",
        },
        keyRingId: "your-key-ring-id",
        member: "user:jane@example.com",
        role: "roles/cloudkms.admin",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    key_ring = gcp.kms.KeyRingIAMMember("keyRing",
        condition=gcp.kms.KeyRingIAMMemberConditionArgs(
            description="Expiring at midnight of 2019-12-31",
            expression="request.time < timestamp(\"2020-01-01T00:00:00Z\")",
            title="expires_after_2019_12_31",
        ),
        key_ring_id="your-key-ring-id",
        member="user:jane@example.com",
        role="roles/cloudkms.admin")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var keyRing = new Gcp.Kms.KeyRingIAMMember("keyRing", new()
        {
            Condition = new Gcp.Kms.Inputs.KeyRingIAMMemberConditionArgs
            {
                Description = "Expiring at midnight of 2019-12-31",
                Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
                Title = "expires_after_2019_12_31",
            },
            KeyRingId = "your-key-ring-id",
            Member = "user:jane@example.com",
            Role = "roles/cloudkms.admin",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/kms"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := kms.NewKeyRingIAMMember(ctx, "keyRing", &kms.KeyRingIAMMemberArgs{
    			Condition: &kms.KeyRingIAMMemberConditionArgs{
    				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"),
    			},
    			KeyRingId: pulumi.String("your-key-ring-id"),
    			Member:    pulumi.String("user:jane@example.com"),
    			Role:      pulumi.String("roles/cloudkms.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.kms.KeyRingIAMMember;
    import com.pulumi.gcp.kms.KeyRingIAMMemberArgs;
    import com.pulumi.gcp.kms.inputs.KeyRingIAMMemberConditionArgs;
    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 keyRing = new KeyRingIAMMember("keyRing", KeyRingIAMMemberArgs.builder()        
                .condition(KeyRingIAMMemberConditionArgs.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())
                .keyRingId("your-key-ring-id")
                .member("user:jane@example.com")
                .role("roles/cloudkms.admin")
                .build());
    
        }
    }
    
    resources:
      keyRing:
        type: gcp:kms:KeyRingIAMMember
        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
          keyRingId: your-key-ring-id
          member: user:jane@example.com
          role: roles/cloudkms.admin
    

    Create KeyRingIAMPolicy Resource

    new KeyRingIAMPolicy(name: string, args: KeyRingIAMPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def KeyRingIAMPolicy(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         key_ring_id: Optional[str] = None,
                         policy_data: Optional[str] = None)
    @overload
    def KeyRingIAMPolicy(resource_name: str,
                         args: KeyRingIAMPolicyArgs,
                         opts: Optional[ResourceOptions] = None)
    func NewKeyRingIAMPolicy(ctx *Context, name string, args KeyRingIAMPolicyArgs, opts ...ResourceOption) (*KeyRingIAMPolicy, error)
    public KeyRingIAMPolicy(string name, KeyRingIAMPolicyArgs args, CustomResourceOptions? opts = null)
    public KeyRingIAMPolicy(String name, KeyRingIAMPolicyArgs args)
    public KeyRingIAMPolicy(String name, KeyRingIAMPolicyArgs args, CustomResourceOptions options)
    
    type: gcp:kms:KeyRingIAMPolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args KeyRingIAMPolicyArgs
    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 KeyRingIAMPolicyArgs
    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 KeyRingIAMPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args KeyRingIAMPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args KeyRingIAMPolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    KeyRingId string

    The key ring ID, in the form {project_id}/{location_name}/{key_ring_name} or {location_name}/{key_ring_name}. In the second form, the provider's project setting will be used as a fallback.

    • member/members - (Required) Identities that will be granted the privilege in role. Each entry can have one of the following values:
    • allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account.
    • allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account.
    • user:{emailid}: An email address that represents a specific Google account. For example, 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.
    PolicyData string

    The policy data generated by a gcp.organizations.getIAMPolicy data source.

    KeyRingId string

    The key ring ID, in the form {project_id}/{location_name}/{key_ring_name} or {location_name}/{key_ring_name}. In the second form, the provider's project setting will be used as a fallback.

    • member/members - (Required) Identities that will be granted the privilege in role. Each entry can have one of the following values:
    • allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account.
    • allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account.
    • user:{emailid}: An email address that represents a specific Google account. For example, 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.
    PolicyData string

    The policy data generated by a gcp.organizations.getIAMPolicy data source.

    keyRingId String

    The key ring ID, in the form {project_id}/{location_name}/{key_ring_name} or {location_name}/{key_ring_name}. In the second form, the provider's project setting will be used as a fallback.

    • member/members - (Required) Identities that will be granted the privilege in role. Each entry can have one of the following values:
    • allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account.
    • allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account.
    • user:{emailid}: An email address that represents a specific Google account. For example, 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.
    policyData String

    The policy data generated by a gcp.organizations.getIAMPolicy data source.

    keyRingId string

    The key ring ID, in the form {project_id}/{location_name}/{key_ring_name} or {location_name}/{key_ring_name}. In the second form, the provider's project setting will be used as a fallback.

    • member/members - (Required) Identities that will be granted the privilege in role. Each entry can have one of the following values:
    • allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account.
    • allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account.
    • user:{emailid}: An email address that represents a specific Google account. For example, 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.
    policyData string

    The policy data generated by a gcp.organizations.getIAMPolicy data source.

    key_ring_id str

    The key ring ID, in the form {project_id}/{location_name}/{key_ring_name} or {location_name}/{key_ring_name}. In the second form, the provider's project setting will be used as a fallback.

    • member/members - (Required) Identities that will be granted the privilege in role. Each entry can have one of the following values:
    • allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account.
    • allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account.
    • user:{emailid}: An email address that represents a specific Google account. For example, 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.
    policy_data str

    The policy data generated by a gcp.organizations.getIAMPolicy data source.

    keyRingId String

    The key ring ID, in the form {project_id}/{location_name}/{key_ring_name} or {location_name}/{key_ring_name}. In the second form, the provider's project setting will be used as a fallback.

    • member/members - (Required) Identities that will be granted the privilege in role. Each entry can have one of the following values:
    • allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account.
    • allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account.
    • user:{emailid}: An email address that represents a specific Google account. For example, 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.
    policyData String

    The policy data generated by a gcp.organizations.getIAMPolicy data source.

    Outputs

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

    Etag string

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

    Id string

    The provider-assigned unique ID for this managed resource.

    Etag string

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

    Id string

    The provider-assigned unique ID for this managed resource.

    etag String

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

    id String

    The provider-assigned unique ID for this managed resource.

    etag string

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

    id string

    The provider-assigned unique ID for this managed resource.

    etag str

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

    id str

    The provider-assigned unique ID for this managed resource.

    etag String

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

    id String

    The provider-assigned unique ID for this managed resource.

    Look up Existing KeyRingIAMPolicy Resource

    Get an existing KeyRingIAMPolicy 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?: KeyRingIAMPolicyState, opts?: CustomResourceOptions): KeyRingIAMPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            etag: Optional[str] = None,
            key_ring_id: Optional[str] = None,
            policy_data: Optional[str] = None) -> KeyRingIAMPolicy
    func GetKeyRingIAMPolicy(ctx *Context, name string, id IDInput, state *KeyRingIAMPolicyState, opts ...ResourceOption) (*KeyRingIAMPolicy, error)
    public static KeyRingIAMPolicy Get(string name, Input<string> id, KeyRingIAMPolicyState? state, CustomResourceOptions? opts = null)
    public static KeyRingIAMPolicy get(String name, Output<String> id, KeyRingIAMPolicyState 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:
    Etag string

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

    KeyRingId string

    The key ring ID, in the form {project_id}/{location_name}/{key_ring_name} or {location_name}/{key_ring_name}. In the second form, the provider's project setting will be used as a fallback.

    • member/members - (Required) Identities that will be granted the privilege in role. Each entry can have one of the following values:
    • allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account.
    • allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account.
    • user:{emailid}: An email address that represents a specific Google account. For example, 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.
    PolicyData string

    The policy data generated by a gcp.organizations.getIAMPolicy data source.

    Etag string

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

    KeyRingId string

    The key ring ID, in the form {project_id}/{location_name}/{key_ring_name} or {location_name}/{key_ring_name}. In the second form, the provider's project setting will be used as a fallback.

    • member/members - (Required) Identities that will be granted the privilege in role. Each entry can have one of the following values:
    • allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account.
    • allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account.
    • user:{emailid}: An email address that represents a specific Google account. For example, 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.
    PolicyData string

    The policy data generated by a gcp.organizations.getIAMPolicy data source.

    etag String

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

    keyRingId String

    The key ring ID, in the form {project_id}/{location_name}/{key_ring_name} or {location_name}/{key_ring_name}. In the second form, the provider's project setting will be used as a fallback.

    • member/members - (Required) Identities that will be granted the privilege in role. Each entry can have one of the following values:
    • allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account.
    • allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account.
    • user:{emailid}: An email address that represents a specific Google account. For example, 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.
    policyData String

    The policy data generated by a gcp.organizations.getIAMPolicy data source.

    etag string

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

    keyRingId string

    The key ring ID, in the form {project_id}/{location_name}/{key_ring_name} or {location_name}/{key_ring_name}. In the second form, the provider's project setting will be used as a fallback.

    • member/members - (Required) Identities that will be granted the privilege in role. Each entry can have one of the following values:
    • allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account.
    • allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account.
    • user:{emailid}: An email address that represents a specific Google account. For example, 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.
    policyData string

    The policy data generated by a gcp.organizations.getIAMPolicy data source.

    etag str

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

    key_ring_id str

    The key ring ID, in the form {project_id}/{location_name}/{key_ring_name} or {location_name}/{key_ring_name}. In the second form, the provider's project setting will be used as a fallback.

    • member/members - (Required) Identities that will be granted the privilege in role. Each entry can have one of the following values:
    • allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account.
    • allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account.
    • user:{emailid}: An email address that represents a specific Google account. For example, 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.
    policy_data str

    The policy data generated by a gcp.organizations.getIAMPolicy data source.

    etag String

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

    keyRingId String

    The key ring ID, in the form {project_id}/{location_name}/{key_ring_name} or {location_name}/{key_ring_name}. In the second form, the provider's project setting will be used as a fallback.

    • member/members - (Required) Identities that will be granted the privilege in role. Each entry can have one of the following values:
    • allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account.
    • allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account.
    • user:{emailid}: An email address that represents a specific Google account. For example, 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.
    policyData String

    The policy data generated by a gcp.organizations.getIAMPolicy data source.

    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 key_ring_id, role, and account e.g.

     $ pulumi import gcp:kms/keyRingIAMPolicy:KeyRingIAMPolicy key_ring_iam "your-project-id/location-name/key-ring-name 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 key_ring_id and role, e.g.

     $ pulumi import gcp:kms/keyRingIAMPolicy:KeyRingIAMPolicy key_ring_iam "your-project-id/location-name/key-ring-name roles/cloudkms.admin"
    

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

    This policy resource can be imported using the key_ring_id, e.g.

     $ pulumi import gcp:kms/keyRingIAMPolicy:KeyRingIAMPolicy key_ring_iam your-project-id/location-name/key-ring-name
    

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the google-beta Terraform Provider.

    gcp logo
    Google Cloud Classic v6.58.0 published on Tuesday, Jun 6, 2023 by Pulumi