pulumi_wasm_providers_gcp_mini::compute

Module disk_iam_binding

source
Expand description

Three different resources help you manage your IAM policy for Compute Engine Disk. Each of these resources serves a different use case:

  • gcp.compute.DiskIamPolicy: Authoritative. Sets the IAM policy for the disk and replaces any existing policy already attached.
  • gcp.compute.DiskIamBinding: 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 disk are preserved.
  • gcp.compute.DiskIamMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the disk are preserved.

A data source can be used to retrieve policy data in advent you do not need creation

  • gcp.compute.DiskIamPolicy: Retrieves the IAM policy for the disk

Note: gcp.compute.DiskIamPolicy cannot be used in conjunction with gcp.compute.DiskIamBinding and gcp.compute.DiskIamMember or they will fight over what your policy should be.

Note: gcp.compute.DiskIamBinding resources can be used in conjunction with gcp.compute.DiskIamMember resources only if they do not grant privilege to the same role.

§gcp.compute.DiskIamPolicy

resources:
  policy:
    type: gcp:compute:DiskIamPolicy
    properties:
      project: ${default.project}
      zone: ${default.zone}
      name: ${default.name}
      policyData: ${admin.policyData}
variables:
  admin:
    fn::invoke:
      function: gcp:organizations:getIAMPolicy
      arguments:
        bindings:
          - role: roles/viewer
            members:
              - user:jane@example.com

§gcp.compute.DiskIamBinding

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let binding = disk_iam_binding::create(
        "binding",
        DiskIamBindingArgs::builder()
            .members(vec!["user:jane@example.com",])
            .name("${default.name}")
            .project("${default.project}")
            .role("roles/viewer")
            .zone("${default.zone}")
            .build_struct(),
    );
}

§gcp.compute.DiskIamMember

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let member = disk_iam_member::create(
        "member",
        DiskIamMemberArgs::builder()
            .member("user:jane@example.com")
            .name("${default.name}")
            .project("${default.project}")
            .role("roles/viewer")
            .zone("${default.zone}")
            .build_struct(),
    );
}

§This resource supports User Project Overrides.

§IAM policy for Compute Engine Disk

Three different resources help you manage your IAM policy for Compute Engine Disk. Each of these resources serves a different use case:

  • gcp.compute.DiskIamPolicy: Authoritative. Sets the IAM policy for the disk and replaces any existing policy already attached.
  • gcp.compute.DiskIamBinding: 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 disk are preserved.
  • gcp.compute.DiskIamMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the disk are preserved.

A data source can be used to retrieve policy data in advent you do not need creation

  • gcp.compute.DiskIamPolicy: Retrieves the IAM policy for the disk

Note: gcp.compute.DiskIamPolicy cannot be used in conjunction with gcp.compute.DiskIamBinding and gcp.compute.DiskIamMember or they will fight over what your policy should be.

Note: gcp.compute.DiskIamBinding resources can be used in conjunction with gcp.compute.DiskIamMember resources only if they do not grant privilege to the same role.

§gcp.compute.DiskIamPolicy

resources:
  policy:
    type: gcp:compute:DiskIamPolicy
    properties:
      project: ${default.project}
      zone: ${default.zone}
      name: ${default.name}
      policyData: ${admin.policyData}
variables:
  admin:
    fn::invoke:
      function: gcp:organizations:getIAMPolicy
      arguments:
        bindings:
          - role: roles/viewer
            members:
              - user:jane@example.com

§gcp.compute.DiskIamBinding

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let binding = disk_iam_binding::create(
        "binding",
        DiskIamBindingArgs::builder()
            .members(vec!["user:jane@example.com",])
            .name("${default.name}")
            .project("${default.project}")
            .role("roles/viewer")
            .zone("${default.zone}")
            .build_struct(),
    );
}

§gcp.compute.DiskIamMember

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let member = disk_iam_member::create(
        "member",
        DiskIamMemberArgs::builder()
            .member("user:jane@example.com")
            .name("${default.name}")
            .project("${default.project}")
            .role("roles/viewer")
            .zone("${default.zone}")
            .build_struct(),
    );
}

§Import

For all import syntaxes, the “resource in question” can take any of the following forms:

  • projects/{{project}}/zones/{{zone}}/disks/{{name}}

  • {{project}}/{{zone}}/{{name}}

  • {{zone}}/{{name}}

  • {{name}}

Any variables not passed in the import command will be taken from the provider configuration.

Compute Engine disk IAM resources can be imported using the resource identifiers, role, and member.

IAM member imports use space-delimited identifiers: the resource in question, the role, and the member identity, e.g.

$ pulumi import gcp:compute/diskIamBinding:DiskIamBinding editor "projects/{{project}}/zones/{{zone}}/disks/{{disk}} roles/viewer user:jane@example.com"

IAM binding imports use space-delimited identifiers: the resource in question and the role, e.g.

$ pulumi import gcp:compute/diskIamBinding:DiskIamBinding editor "projects/{{project}}/zones/{{zone}}/disks/{{disk}} roles/viewer"

IAM policy imports use the identifier of the resource in question, e.g.

$ pulumi import gcp:compute/diskIamBinding:DiskIamBinding editor projects/{{project}}/zones/{{zone}}/disks/{{disk}}

-> Custom Roles If you’re importing a IAM resource with a custom role, make sure to use the

full name of the custom role, e.g. [projects/my-project|organizations/my-org]/roles/my-custom-role.

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments