CmekConfig class

CmekConfig represents configurations used to enable CMEK data encryption with Cloud KMS keys.

To get more information about CmekConfig, see:

Example Usage

Discoveryengine Cmekconfig Default

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

const project = gcp.organizations.getProject({});
const cryptoKey = new gcp.kms.CryptoKeyIAMMember("crypto_key", {
    cryptoKeyId: "kms-key-name",
    role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
    member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-discoveryengine.iam.gserviceaccount.com`),
});
const _default = new gcp.discoveryengine.CmekConfig("default", {
    location: "us",
    cmekConfigId: "cmek-config-id",
    kmsKey: "kms-key-name",
}, {
    dependsOn: [cryptoKey],
});
import pulumi
import pulumi_gcp as gcp

project = gcp.organizations.get_project()
crypto_key = gcp.kms.CryptoKeyIAMMember("crypto_key",
    crypto_key_id="kms-key-name",
    role="roles/cloudkms.cryptoKeyEncrypterDecrypter",
    member=f"serviceAccount:service-{project.number}@gcp-sa-discoveryengine.iam.gserviceaccount.com")
default = gcp.discoveryengine.CmekConfig("default",
    location="us",
    cmek_config_id="cmek-config-id",
    kms_key="kms-key-name",
    opts = pulumi.ResourceOptions(depends_on=[crypto_key]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var project = Gcp.Organizations.GetProject.Invoke();

    var cryptoKey = new Gcp.Kms.CryptoKeyIAMMember("crypto_key", new()
    {
        CryptoKeyId = "kms-key-name",
        Role = "roles/cloudkms.cryptoKeyEncrypterDecrypter",
        Member = $"serviceAccount:service-{project.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-discoveryengine.iam.gserviceaccount.com",
    });

    var @default = new Gcp.DiscoveryEngine.CmekConfig("default", new()
    {
        Location = "us",
        CmekConfigId = "cmek-config-id",
        KmsKey = "kms-key-name",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            cryptoKey,
        },
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		project, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
		if err != nil {
			return err
		}
		cryptoKey, err := kms.NewCryptoKeyIAMMember(ctx, "crypto_key", &kms.CryptoKeyIAMMemberArgs{
			CryptoKeyId: pulumi.String("kms-key-name"),
			Role:        pulumi.String("roles/cloudkms.cryptoKeyEncrypterDecrypter"),
			Member:      pulumi.Sprintf("serviceAccount:service-%v@gcp-sa-discoveryengine.iam.gserviceaccount.com", project.Number),
		})
		if err != nil {
			return err
		}
		_, err = discoveryengine.NewCmekConfig(ctx, "default", &discoveryengine.CmekConfigArgs{
			Location:     pulumi.String("us"),
			CmekConfigId: pulumi.String("cmek-config-id"),
			KmsKey:       pulumi.String("kms-key-name"),
		}, pulumi.DependsOn([]pulumi.Resource{
			cryptoKey,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

data "gcp_organizations_getproject" "project" {
}

resource "gcp_discoveryengine_cmekconfig" "default" {
  depends_on     = [gcp_kms_cryptokeyiammember.crypto_key]
  location       = "us"
  cmek_config_id = "cmek-config-id"
  kms_key        = "kms-key-name"
}
resource "gcp_kms_cryptokeyiammember" "crypto_key" {
  crypto_key_id = "kms-key-name"
  role          = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
  member        ="serviceAccount:service-${data.gcp_organizations_getproject.project.number}@gcp-sa-discoveryengine.iam.gserviceaccount.com"
}
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.GetProjectArgs;
import com.pulumi.gcp.kms.CryptoKeyIAMMember;
import com.pulumi.gcp.kms.CryptoKeyIAMMemberArgs;
import com.pulumi.gcp.discoveryengine.CmekConfig;
import com.pulumi.gcp.discoveryengine.CmekConfigArgs;
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) {
        final var project = OrganizationsFunctions.getProject(GetProjectArgs.builder()
            .build());

        var cryptoKey = new CryptoKeyIAMMember("cryptoKey", CryptoKeyIAMMemberArgs.builder()
            .cryptoKeyId("kms-key-name")
            .role("roles/cloudkms.cryptoKeyEncrypterDecrypter")
            .member(String.format("serviceAccount:service-%s@gcp-sa-discoveryengine.iam.gserviceaccount.com", project.number()))
            .build());

        var default_ = new CmekConfig("default", CmekConfigArgs.builder()
            .location("us")
            .cmekConfigId("cmek-config-id")
            .kmsKey("kms-key-name")
            .build(), CustomResourceOptions.builder()
                .dependsOn(cryptoKey)
                .build());

    }
}
resources:
  default:
    type: gcp:discoveryengine:CmekConfig
    properties:
      location: us
      cmekConfigId: cmek-config-id
      kmsKey: kms-key-name
    options:
      dependsOn:
        - ${cryptoKey}
  cryptoKey:
    type: gcp:kms:CryptoKeyIAMMember
    name: crypto_key
    properties:
      cryptoKeyId: kms-key-name
      role: roles/cloudkms.cryptoKeyEncrypterDecrypter
      member: serviceAccount:service-${project.number}@gcp-sa-discoveryengine.iam.gserviceaccount.com
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}

Import

CmekConfig can be imported using any of these accepted formats:

  • projects/{{project}}/locations/{{location}}/cmekConfigs/{{cmek_config_id}}
  • {{project}}/{{location}}/{{cmek_config_id}}
  • {{location}}/{{cmek_config_id}}

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

$ pulumi import gcp:discoveryengine/cmekConfig:CmekConfig default projects/{{project}}/locations/{{location}}/cmekConfigs/{{cmek_config_id}}
$ pulumi import gcp:discoveryengine/cmekConfig:CmekConfig default {{project}}/{{location}}/{{cmek_config_id}}
$ pulumi import gcp:discoveryengine/cmekConfig:CmekConfig default {{location}}/{{cmek_config_id}}

Constructors

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

Properties

childResources → Set<Resource>
finalinherited
cmekConfigId ↔ Output<String>
The unique id of the cmek config.
latefinal
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
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isDefault ↔ Output<bool>
The default CmekConfig for the Customer.
latefinal
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
kmsKey ↔ Output<String>
KMS key resource name which will be used to encrypt resources projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{keyId}.
latefinal
kmsKeyVersion ↔ Output<String>
KMS key version resource name which will be used to encrypt resources &lt;kms_key&gt;/cryptoKeyVersions/{keyVersion}.
latefinal
lastRotationTimestampMicros ↔ Output<int>
The timestamp of the last key rotation.
latefinal
location ↔ Output<String>
The geographic location where the CMEK config should reside. The value can only be one of "us" and "eu".
latefinal
name ↔ Output<String>
The unique full resource name of the cmek config. Values are of the format projects/{project}/locations/{location}/cmekConfigs/{cmek_config_id}. This field must be a UTF-8 encoded string with a length limit of 1024 characters.
latefinal
notebooklmState ↔ Output<String>
Whether the NotebookLM Corpus is ready to be used.
latefinal
project ↔ Output<String>
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
setDefault ↔ Output<bool?>
Set the following CmekConfig as the default to be used for child resources if one is not specified. The default value is true.
latefinal
singleRegionKeys ↔ Output<List<CmekConfigSingleRegionKey>?>
Single-regional CMEKs that are required for some VAIS features. Structure is documented below.
latefinal
state ↔ Output<String>
The state of the CmekConfig.
latefinal
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, {CmekConfigState? state, CustomResourceOptions? options}) → CmekConfig
Gets an existing CmekConfig resource's state with the given name and id.