pulumi_wasm_providers_gcp_mini::compute

Module region_disk_iam_member

source
Expand description

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

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

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

  • gcp.compute.RegionDiskIamPolicy: Retrieves the IAM policy for the regiondisk

Note: gcp.compute.RegionDiskIamPolicy cannot be used in conjunction with gcp.compute.RegionDiskIamBinding and gcp.compute.RegionDiskIamMember or they will fight over what your policy should be.

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

§gcp.compute.RegionDiskIamPolicy

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

§gcp.compute.RegionDiskIamBinding

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

§gcp.compute.RegionDiskIamMember

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

§This resource supports User Project Overrides.

§IAM policy for Compute Engine RegionDisk

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

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

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

  • gcp.compute.RegionDiskIamPolicy: Retrieves the IAM policy for the regiondisk

Note: gcp.compute.RegionDiskIamPolicy cannot be used in conjunction with gcp.compute.RegionDiskIamBinding and gcp.compute.RegionDiskIamMember or they will fight over what your policy should be.

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

§gcp.compute.RegionDiskIamPolicy

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

§gcp.compute.RegionDiskIamBinding

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

§gcp.compute.RegionDiskIamMember

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

§Import

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

  • projects/{{project}}/regions/{{region}}/disks/{{name}}

  • {{project}}/{{region}}/{{name}}

  • {{region}}/{{name}}

  • {{name}}

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

Compute Engine regiondisk 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/regionDiskIamMember:RegionDiskIamMember editor "projects/{{project}}/regions/{{region}}/disks/{{region_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/regionDiskIamMember:RegionDiskIamMember editor "projects/{{project}}/regions/{{region}}/disks/{{region_disk}} roles/viewer"

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

$ pulumi import gcp:compute/regionDiskIamMember:RegionDiskIamMember editor projects/{{project}}/regions/{{region}}/disks/{{region_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