AccessApprovalSettings class

Access Approval enables you to require your explicit approval whenever Google support and engineering need to access your customer content.

To get more information about ProjectSettings, see:

Example Usage

Project Access Approval Full

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

const projectAccessApproval = new gcp.projects.AccessApprovalSettings("project_access_approval", {
    projectId: "my-project-name",
    notificationEmails: [
        "testuser@example.com",
        "example.user@example.com",
    ],
    enrolledServices: [{
        cloudProduct: "all",
        enrollmentLevel: "BLOCK_ALL",
    }],
});
import pulumi
import pulumi_gcp as gcp

project_access_approval = gcp.projects.AccessApprovalSettings("project_access_approval",
    project_id="my-project-name",
    notification_emails=[
        "testuser@example.com",
        "example.user@example.com",
    ],
    enrolled_services=[{
        "cloud_product": "all",
        "enrollment_level": "BLOCK_ALL",
    }])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var projectAccessApproval = new Gcp.Projects.AccessApprovalSettings("project_access_approval", new()
    {
        ProjectId = "my-project-name",
        NotificationEmails = new[]
        {
            "testuser@example.com",
            "example.user@example.com",
        },
        EnrolledServices = new[]
        {
            new Gcp.Projects.Inputs.AccessApprovalSettingsEnrolledServiceArgs
            {
                CloudProduct = "all",
                EnrollmentLevel = "BLOCK_ALL",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/projects"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := projects.NewAccessApprovalSettings(ctx, "project_access_approval", &projects.AccessApprovalSettingsArgs{
			ProjectId: pulumi.String("my-project-name"),
			NotificationEmails: pulumi.StringArray{
				pulumi.String("testuser@example.com"),
				pulumi.String("example.user@example.com"),
			},
			EnrolledServices: projects.AccessApprovalSettingsEnrolledServiceArray{
				&projects.AccessApprovalSettingsEnrolledServiceArgs{
					CloudProduct:    pulumi.String("all"),
					EnrollmentLevel: pulumi.String("BLOCK_ALL"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_projects_accessapprovalsettings" "project_access_approval" {
  project_id          = "my-project-name"
  notification_emails = ["testuser@example.com", "example.user@example.com"]
  enrolled_services {
    cloud_product    = "all"
    enrollment_level = "BLOCK_ALL"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.projects.AccessApprovalSettings;
import com.pulumi.gcp.projects.AccessApprovalSettingsArgs;
import com.pulumi.gcp.projects.inputs.AccessApprovalSettingsEnrolledServiceArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 projectAccessApproval = new AccessApprovalSettings("projectAccessApproval", AccessApprovalSettingsArgs.builder()
            .projectId("my-project-name")
            .notificationEmails(
                "testuser@example.com",
                "example.user@example.com")
            .enrolledServices(AccessApprovalSettingsEnrolledServiceArgs.builder()
                .cloudProduct("all")
                .enrollmentLevel("BLOCK_ALL")
                .build())
            .build());

    }
}
resources:
  projectAccessApproval:
    type: gcp:projects:AccessApprovalSettings
    name: project_access_approval
    properties:
      projectId: my-project-name
      notificationEmails:
        - testuser@example.com
        - example.user@example.com
      enrolledServices:
        - cloudProduct: all
          enrollmentLevel: BLOCK_ALL

Project Access Approval Active Key Version

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

const keyRing = new gcp.kms.KeyRing("key_ring", {
    name: "key-ring",
    location: "global",
    project: "my-project-name",
});
const cryptoKey = new gcp.kms.CryptoKey("crypto_key", {
    name: "crypto-key",
    keyRing: keyRing.id,
    purpose: "ASYMMETRIC_SIGN",
    versionTemplate: {
        algorithm: "EC_SIGN_P384_SHA384",
    },
});
const serviceAccount = gcp.accessapproval.getProjectServiceAccount({
    projectId: "my-project-name",
});
const iam = new gcp.kms.CryptoKeyIAMMember("iam", {
    cryptoKeyId: cryptoKey.id,
    role: "roles/cloudkms.signerVerifier",
    member: serviceAccount.then(serviceAccount => `serviceAccount:${serviceAccount.accountEmail}`),
});
const cryptoKeyVersion = gcp.kms.getKMSCryptoKeyVersionOutput({
    cryptoKey: cryptoKey.id,
});
const projectAccessApproval = new gcp.projects.AccessApprovalSettings("project_access_approval", {
    projectId: "my-project-name",
    activeKeyVersion: cryptoKeyVersion.name,
    enrolledServices: [{
        cloudProduct: "all",
    }],
}, {
    dependsOn: [iam],
});
import pulumi
import pulumi_gcp as gcp

key_ring = gcp.kms.KeyRing("key_ring",
    name="key-ring",
    location="global",
    project="my-project-name")
crypto_key = gcp.kms.CryptoKey("crypto_key",
    name="crypto-key",
    key_ring=key_ring.id,
    purpose="ASYMMETRIC_SIGN",
    version_template={
        "algorithm": "EC_SIGN_P384_SHA384",
    })
service_account = gcp.accessapproval.get_project_service_account(project_id="my-project-name")
iam = gcp.kms.CryptoKeyIAMMember("iam",
    crypto_key_id=crypto_key.id,
    role="roles/cloudkms.signerVerifier",
    member=f"serviceAccount:{service_account.account_email}")
crypto_key_version = gcp.kms.get_kms_crypto_key_version_output(crypto_key=crypto_key.id)
project_access_approval = gcp.projects.AccessApprovalSettings("project_access_approval",
    project_id="my-project-name",
    active_key_version=crypto_key_version.name,
    enrolled_services=[{
        "cloud_product": "all",
    }],
    opts = pulumi.ResourceOptions(depends_on=[iam]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var keyRing = new Gcp.Kms.KeyRing("key_ring", new()
    {
        Name = "key-ring",
        Location = "global",
        Project = "my-project-name",
    });

    var cryptoKey = new Gcp.Kms.CryptoKey("crypto_key", new()
    {
        Name = "crypto-key",
        KeyRing = keyRing.Id,
        Purpose = "ASYMMETRIC_SIGN",
        VersionTemplate = new Gcp.Kms.Inputs.CryptoKeyVersionTemplateArgs
        {
            Algorithm = "EC_SIGN_P384_SHA384",
        },
    });

    var serviceAccount = Gcp.AccessApproval.GetProjectServiceAccount.Invoke(new()
    {
        ProjectId = "my-project-name",
    });

    var iam = new Gcp.Kms.CryptoKeyIAMMember("iam", new()
    {
        CryptoKeyId = cryptoKey.Id,
        Role = "roles/cloudkms.signerVerifier",
        Member = $"serviceAccount:{serviceAccount.Apply(getProjectServiceAccountResult => getProjectServiceAccountResult.AccountEmail)}",
    });

    var cryptoKeyVersion = Gcp.Kms.GetKMSCryptoKeyVersion.Invoke(new()
    {
        CryptoKey = cryptoKey.Id,
    });

    var projectAccessApproval = new Gcp.Projects.AccessApprovalSettings("project_access_approval", new()
    {
        ProjectId = "my-project-name",
        ActiveKeyVersion = cryptoKeyVersion.Apply(getKMSCryptoKeyVersionResult => getKMSCryptoKeyVersionResult.Name),
        EnrolledServices = new[]
        {
            new Gcp.Projects.Inputs.AccessApprovalSettingsEnrolledServiceArgs
            {
                CloudProduct = "all",
            },
        },
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            iam,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/accessapproval"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/kms"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/projects"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		keyRing, err := kms.NewKeyRing(ctx, "key_ring", &kms.KeyRingArgs{
			Name:     pulumi.String("key-ring"),
			Location: pulumi.String("global"),
			Project:  pulumi.String("my-project-name"),
		})
		if err != nil {
			return err
		}
		cryptoKey, err := kms.NewCryptoKey(ctx, "crypto_key", &kms.CryptoKeyArgs{
			Name:    pulumi.String("crypto-key"),
			KeyRing: keyRing.ID().ToIDOutput().ToStringOutput(),
			Purpose: pulumi.String("ASYMMETRIC_SIGN"),
			VersionTemplate: &kms.CryptoKeyVersionTemplateArgs{
				Algorithm: pulumi.String("EC_SIGN_P384_SHA384"),
			},
		})
		if err != nil {
			return err
		}
		serviceAccount, err := accessapproval.GetProjectServiceAccount(ctx, &accessapproval.GetProjectServiceAccountArgs{
			ProjectId: "my-project-name",
		}, nil)
		if err != nil {
			return err
		}
		iam, err := kms.NewCryptoKeyIAMMember(ctx, "iam", &kms.CryptoKeyIAMMemberArgs{
			CryptoKeyId: cryptoKey.ID().ToIDOutput().ToStringOutput(),
			Role:        pulumi.String("roles/cloudkms.signerVerifier"),
			Member:      pulumi.Sprintf("serviceAccount:%v", serviceAccount.AccountEmail),
		})
		if err != nil {
			return err
		}
		cryptoKeyVersion := kms.GetKMSCryptoKeyVersionOutput(ctx, kms.GetKMSCryptoKeyVersionOutputArgs{
			CryptoKey: cryptoKey.ID().ToIDOutput().ToStringOutput(),
		}, nil)
		_, err = projects.NewAccessApprovalSettings(ctx, "project_access_approval", &projects.AccessApprovalSettingsArgs{
			ProjectId:        pulumi.String("my-project-name"),
			ActiveKeyVersion: cryptoKeyVersion.Name(),
			EnrolledServices: projects.AccessApprovalSettingsEnrolledServiceArray{
				&projects.AccessApprovalSettingsEnrolledServiceArgs{
					CloudProduct: pulumi.String("all"),
				},
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			iam,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

data "gcp_accessapproval_getprojectserviceaccount" "serviceAccount" {
  project_id = "my-project-name"
}
data "gcp_kms_getkmscryptokeyversion" "cryptoKeyVersion" {
  crypto_key = gcp_kms_cryptokey.crypto_key.id
}

resource "gcp_kms_keyring" "key_ring" {
  name     = "key-ring"
  location = "global"
  project  = "my-project-name"
}
resource "gcp_kms_cryptokey" "crypto_key" {
  name     = "crypto-key"
  key_ring = gcp_kms_keyring.key_ring.id
  purpose  = "ASYMMETRIC_SIGN"
  version_template = {
    algorithm = "EC_SIGN_P384_SHA384"
  }
}
resource "gcp_kms_cryptokeyiammember" "iam" {
  crypto_key_id = gcp_kms_cryptokey.crypto_key.id
  role          = "roles/cloudkms.signerVerifier"
  member        ="serviceAccount:${data.gcp_accessapproval_getprojectserviceaccount.serviceAccount.account_email}"
}
resource "gcp_projects_accessapprovalsettings" "project_access_approval" {
  depends_on         = [gcp_kms_cryptokeyiammember.iam]
  project_id         = "my-project-name"
  active_key_version = data.gcp_kms_getkmscryptokeyversion.cryptoKeyVersion.name
  enrolled_services {
    cloud_product = "all"
  }
}
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.kms.CryptoKey;
import com.pulumi.gcp.kms.CryptoKeyArgs;
import com.pulumi.gcp.kms.inputs.CryptoKeyVersionTemplateArgs;
import com.pulumi.gcp.accessapproval.AccessapprovalFunctions;
import com.pulumi.gcp.accessapproval.inputs.GetProjectServiceAccountArgs;
import com.pulumi.gcp.kms.CryptoKeyIAMMember;
import com.pulumi.gcp.kms.CryptoKeyIAMMemberArgs;
import com.pulumi.gcp.kms.KmsFunctions;
import com.pulumi.gcp.kms.inputs.GetKMSCryptoKeyVersionArgs;
import com.pulumi.gcp.projects.AccessApprovalSettings;
import com.pulumi.gcp.projects.AccessApprovalSettingsArgs;
import com.pulumi.gcp.projects.inputs.AccessApprovalSettingsEnrolledServiceArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
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()
            .name("key-ring")
            .location("global")
            .project("my-project-name")
            .build());

        var cryptoKey = new CryptoKey("cryptoKey", CryptoKeyArgs.builder()
            .name("crypto-key")
            .keyRing(keyRing.id())
            .purpose("ASYMMETRIC_SIGN")
            .versionTemplate(CryptoKeyVersionTemplateArgs.builder()
                .algorithm("EC_SIGN_P384_SHA384")
                .build())
            .build());

        final var serviceAccount = AccessapprovalFunctions.getProjectServiceAccount(GetProjectServiceAccountArgs.builder()
            .projectId("my-project-name")
            .build());

        var iam = new CryptoKeyIAMMember("iam", CryptoKeyIAMMemberArgs.builder()
            .cryptoKeyId(cryptoKey.id())
            .role("roles/cloudkms.signerVerifier")
            .member(String.format("serviceAccount:%s", serviceAccount.accountEmail()))
            .build());

        final var cryptoKeyVersion = KmsFunctions.getKMSCryptoKeyVersion(GetKMSCryptoKeyVersionArgs.builder()
            .cryptoKey(cryptoKey.id())
            .build());

        var projectAccessApproval = new AccessApprovalSettings("projectAccessApproval", AccessApprovalSettingsArgs.builder()
            .projectId("my-project-name")
            .activeKeyVersion(cryptoKeyVersion.applyValue(_cryptoKeyVersion -> _cryptoKeyVersion.name()))
            .enrolledServices(AccessApprovalSettingsEnrolledServiceArgs.builder()
                .cloudProduct("all")
                .build())
            .build(), CustomResourceOptions.builder()
                .dependsOn(iam)
                .build());

    }
}
resources:
  keyRing:
    type: gcp:kms:KeyRing
    name: key_ring
    properties:
      name: key-ring
      location: global
      project: my-project-name
  cryptoKey:
    type: gcp:kms:CryptoKey
    name: crypto_key
    properties:
      name: crypto-key
      keyRing: ${keyRing.id}
      purpose: ASYMMETRIC_SIGN
      versionTemplate:
        algorithm: EC_SIGN_P384_SHA384
  iam:
    type: gcp:kms:CryptoKeyIAMMember
    properties:
      cryptoKeyId: ${cryptoKey.id}
      role: roles/cloudkms.signerVerifier
      member: serviceAccount:${serviceAccount.accountEmail}
  projectAccessApproval:
    type: gcp:projects:AccessApprovalSettings
    name: project_access_approval
    properties:
      projectId: my-project-name
      activeKeyVersion: ${cryptoKeyVersion.name}
      enrolledServices:
        - cloudProduct: all
    options:
      dependsOn:
        - ${iam}
variables:
  serviceAccount:
    fn::invoke:
      function: gcp:accessapproval:getProjectServiceAccount
      arguments:
        projectId: my-project-name
  cryptoKeyVersion:
    fn::invoke:
      function: gcp:kms:getKMSCryptoKeyVersion
      arguments:
        cryptoKey: ${cryptoKey.id}

Import

ProjectSettings can be imported using any of these accepted formats:

  • projects/{{project_id}}/accessApprovalSettings
  • {{project_id}}

When using the pulumi import command, ProjectSettings can be imported using one of the formats above. For example:

$ pulumi import gcp:projects/accessApprovalSettings:AccessApprovalSettings default projects/{{project_id}}/accessApprovalSettings
$ pulumi import gcp:projects/accessApprovalSettings:AccessApprovalSettings default {{project_id}}

Constructors

AccessApprovalSettings(String name, {AccessApprovalSettingsArgs? args, CustomResourceOptions? options})
Creates a new AccessApprovalSettings. name The Pulumi resource name. args Arguments used to configure this AccessApprovalSettings. The set of arguments for AccessApprovalSettings. options Resource options controlling this resource's behavior.
AccessApprovalSettings.reference(String urn)
Creates a typed reference to an existing AccessApprovalSettings resource.

Properties

activeKeyVersion ↔ Output<String?>
The asymmetric crypto key version to use for signing approval requests. Empty activeKeyVersion indicates that a Google-managed key should be used for signing. This property will be ignored if set by an ancestor of the resource, and new non-empty values may not be set.
latefinal
ancestorHasActiveKeyVersion ↔ Output<bool>
If the field is true, that indicates that an ancestor of this Project has set active_key_version.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
deletionPolicy ↔ Output<String>
Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
latefinal
enrolledAncestor ↔ Output<bool>
If the field is true, that indicates that at least one service is enrolled for Access Approval in one or more ancestors of the Project.
latefinal
enrolledServices ↔ Output<List<AccessApprovalSettingsEnrolledService>>
A list of Google Cloud Services for which the given resource has Access Approval enrolled. Access requests for the resource given by name against any of these services contained here will be required to have explicit approval. Enrollment can only be done on an all or nothing basis. A maximum of 10 enrolled services will be enforced, to be expanded as the set of supported services is expanded. Structure is documented below.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
invalidKeyVersion ↔ Output<bool>
If the field is true, that indicates that there is some configuration issue with the activeKeyVersion configured on this Project (e.g. it doesn't exist or the Access Approval service account doesn't have the correct permissions on it, etc.) This key version is not necessarily the effective key version at this level, as key versions are inherited top-down.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
name ↔ Output<String>
The resource name of the settings. Format is "projects/{project_id}/accessApprovalSettings"
latefinal
notificationEmails ↔ Output<List<String>>
A list of email addresses to which notifications relating to approval requests should be sent. Notifications relating to a resource will be sent to all emails in the settings of ancestor resources of that resource. A maximum of 50 email addresses are allowed.
latefinal
project ↔ Output<String?>
(Optional, Deprecated) Project id.
latefinal
projectId ↔ Output<String>
ID of the project of the access approval settings.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {AccessApprovalSettingsState? state, CustomResourceOptions? options}) → AccessApprovalSettings
Gets an existing AccessApprovalSettings resource's state with the given name and id.