Asset class

The Dataplex Asset resource

Example Usage

Basic_asset

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

const basicBucket = new gcp.storage.Bucket("basic_bucket", {
    name: "bucket",
    location: "us-west1",
    uniformBucketLevelAccess: true,
    project: "my-project-name",
});
const basicLake = new gcp.dataplex.Lake("basic_lake", {
    name: "lake",
    location: "us-west1",
    project: "my-project-name",
});
const basicZone = new gcp.dataplex.Zone("basic_zone", {
    name: "zone",
    location: "us-west1",
    lake: basicLake.name,
    type: "RAW",
    discoverySpec: {
        enabled: false,
    },
    resourceSpec: {
        locationType: "SINGLE_REGION",
    },
    project: "my-project-name",
});
const primary = new gcp.dataplex.Asset("primary", {
    name: "asset",
    location: "us-west1",
    lake: basicLake.name,
    dataplexZone: basicZone.name,
    discoverySpec: {
        enabled: false,
    },
    resourceSpec: {
        name: "projects/my-project-name/buckets/bucket",
        type: "STORAGE_BUCKET",
    },
    labels: {
        env: "foo",
        "my-asset": "exists",
    },
    project: "my-project-name",
}, {
    dependsOn: [basicBucket],
});
import pulumi
import pulumi_gcp as gcp

basic_bucket = gcp.storage.Bucket("basic_bucket",
    name="bucket",
    location="us-west1",
    uniform_bucket_level_access=True,
    project="my-project-name")
basic_lake = gcp.dataplex.Lake("basic_lake",
    name="lake",
    location="us-west1",
    project="my-project-name")
basic_zone = gcp.dataplex.Zone("basic_zone",
    name="zone",
    location="us-west1",
    lake=basic_lake.name,
    type="RAW",
    discovery_spec={
        "enabled": False,
    },
    resource_spec={
        "location_type": "SINGLE_REGION",
    },
    project="my-project-name")
primary = gcp.dataplex.Asset("primary",
    name="asset",
    location="us-west1",
    lake=basic_lake.name,
    dataplex_zone=basic_zone.name,
    discovery_spec={
        "enabled": False,
    },
    resource_spec={
        "name": "projects/my-project-name/buckets/bucket",
        "type": "STORAGE_BUCKET",
    },
    labels={
        "env": "foo",
        "my-asset": "exists",
    },
    project="my-project-name",
    opts = pulumi.ResourceOptions(depends_on=[basic_bucket]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var basicBucket = new Gcp.Storage.Bucket("basic_bucket", new()
    {
        Name = "bucket",
        Location = "us-west1",
        UniformBucketLevelAccess = true,
        Project = "my-project-name",
    });

    var basicLake = new Gcp.DataPlex.Lake("basic_lake", new()
    {
        Name = "lake",
        Location = "us-west1",
        Project = "my-project-name",
    });

    var basicZone = new Gcp.DataPlex.Zone("basic_zone", new()
    {
        Name = "zone",
        Location = "us-west1",
        Lake = basicLake.Name,
        Type = "RAW",
        DiscoverySpec = new Gcp.DataPlex.Inputs.ZoneDiscoverySpecArgs
        {
            Enabled = false,
        },
        ResourceSpec = new Gcp.DataPlex.Inputs.ZoneResourceSpecArgs
        {
            LocationType = "SINGLE_REGION",
        },
        Project = "my-project-name",
    });

    var primary = new Gcp.DataPlex.Asset("primary", new()
    {
        Name = "asset",
        Location = "us-west1",
        Lake = basicLake.Name,
        DataplexZone = basicZone.Name,
        DiscoverySpec = new Gcp.DataPlex.Inputs.AssetDiscoverySpecArgs
        {
            Enabled = false,
        },
        ResourceSpec = new Gcp.DataPlex.Inputs.AssetResourceSpecArgs
        {
            Name = "projects/my-project-name/buckets/bucket",
            Type = "STORAGE_BUCKET",
        },
        Labels =
        {
            { "env", "foo" },
            { "my-asset", "exists" },
        },
        Project = "my-project-name",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            basicBucket,
        },
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		basicBucket, err := storage.NewBucket(ctx, "basic_bucket", &storage.BucketArgs{
			Name:                     pulumi.String("bucket"),
			Location:                 pulumi.String("us-west1"),
			UniformBucketLevelAccess: pulumi.Bool(true),
			Project:                  pulumi.String("my-project-name"),
		})
		if err != nil {
			return err
		}
		basicLake, err := dataplex.NewLake(ctx, "basic_lake", &dataplex.LakeArgs{
			Name:     pulumi.String("lake"),
			Location: pulumi.String("us-west1"),
			Project:  pulumi.String("my-project-name"),
		})
		if err != nil {
			return err
		}
		basicZone, err := dataplex.NewZone(ctx, "basic_zone", &dataplex.ZoneArgs{
			Name:     pulumi.String("zone"),
			Location: pulumi.String("us-west1"),
			Lake:     basicLake.Name,
			Type:     pulumi.String("RAW"),
			DiscoverySpec: &dataplex.ZoneDiscoverySpecArgs{
				Enabled: pulumi.Bool(false),
			},
			ResourceSpec: &dataplex.ZoneResourceSpecArgs{
				LocationType: pulumi.String("SINGLE_REGION"),
			},
			Project: pulumi.String("my-project-name"),
		})
		if err != nil {
			return err
		}
		_, err = dataplex.NewAsset(ctx, "primary", &dataplex.AssetArgs{
			Name:         pulumi.String("asset"),
			Location:     pulumi.String("us-west1"),
			Lake:         basicLake.Name,
			DataplexZone: basicZone.Name,
			DiscoverySpec: &dataplex.AssetDiscoverySpecArgs{
				Enabled: pulumi.Bool(false),
			},
			ResourceSpec: &dataplex.AssetResourceSpecArgs{
				Name: pulumi.String("projects/my-project-name/buckets/bucket"),
				Type: pulumi.String("STORAGE_BUCKET"),
			},
			Labels: pulumi.StringMap{
				"env":      pulumi.String("foo"),
				"my-asset": pulumi.String("exists"),
			},
			Project: pulumi.String("my-project-name"),
		}, pulumi.DependsOn([]pulumi.Resource{
			basicBucket,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_storage_bucket" "basic_bucket" {
  name                        = "bucket"
  location                    = "us-west1"
  uniform_bucket_level_access = true
  project                     = "my-project-name"
}
resource "gcp_dataplex_lake" "basic_lake" {
  name     = "lake"
  location = "us-west1"
  project  = "my-project-name"
}
resource "gcp_dataplex_zone" "basic_zone" {
  name     = "zone"
  location = "us-west1"
  lake     = gcp_dataplex_lake.basic_lake.name
  type     = "RAW"
  discovery_spec = {
    enabled = false
  }
  resource_spec = {
    location_type = "SINGLE_REGION"
  }
  project = "my-project-name"
}
resource "gcp_dataplex_asset" "primary" {
  depends_on    = [gcp_storage_bucket.basic_bucket]
  name          = "asset"
  location      = "us-west1"
  lake          = gcp_dataplex_lake.basic_lake.name
  dataplex_zone = gcp_dataplex_zone.basic_zone.name
  discovery_spec = {
    enabled = false
  }
  resource_spec = {
    name = "projects/my-project-name/buckets/bucket"
    type = "STORAGE_BUCKET"
  }
  labels = {
    "env"      = "foo"
    "my-asset" = "exists"
  }
  project = "my-project-name"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.gcp.dataplex.Lake;
import com.pulumi.gcp.dataplex.LakeArgs;
import com.pulumi.gcp.dataplex.Zone;
import com.pulumi.gcp.dataplex.ZoneArgs;
import com.pulumi.gcp.dataplex.inputs.ZoneDiscoverySpecArgs;
import com.pulumi.gcp.dataplex.inputs.ZoneResourceSpecArgs;
import com.pulumi.gcp.dataplex.Asset;
import com.pulumi.gcp.dataplex.AssetArgs;
import com.pulumi.gcp.dataplex.inputs.AssetDiscoverySpecArgs;
import com.pulumi.gcp.dataplex.inputs.AssetResourceSpecArgs;
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 basicBucket = new Bucket("basicBucket", BucketArgs.builder()
            .name("bucket")
            .location("us-west1")
            .uniformBucketLevelAccess(true)
            .project("my-project-name")
            .build());

        var basicLake = new Lake("basicLake", LakeArgs.builder()
            .name("lake")
            .location("us-west1")
            .project("my-project-name")
            .build());

        var basicZone = new Zone("basicZone", ZoneArgs.builder()
            .name("zone")
            .location("us-west1")
            .lake(basicLake.name())
            .type("RAW")
            .discoverySpec(ZoneDiscoverySpecArgs.builder()
                .enabled(false)
                .build())
            .resourceSpec(ZoneResourceSpecArgs.builder()
                .locationType("SINGLE_REGION")
                .build())
            .project("my-project-name")
            .build());

        var primary = new Asset("primary", AssetArgs.builder()
            .name("asset")
            .location("us-west1")
            .lake(basicLake.name())
            .dataplexZone(basicZone.name())
            .discoverySpec(AssetDiscoverySpecArgs.builder()
                .enabled(false)
                .build())
            .resourceSpec(AssetResourceSpecArgs.builder()
                .name("projects/my-project-name/buckets/bucket")
                .type("STORAGE_BUCKET")
                .build())
            .labels(Map.ofEntries(
                Map.entry("env", "foo"),
                Map.entry("my-asset", "exists")
            ))
            .project("my-project-name")
            .build(), CustomResourceOptions.builder()
                .dependsOn(basicBucket)
                .build());

    }
}
resources:
  basicBucket:
    type: gcp:storage:Bucket
    name: basic_bucket
    properties:
      name: bucket
      location: us-west1
      uniformBucketLevelAccess: true
      project: my-project-name
  basicLake:
    type: gcp:dataplex:Lake
    name: basic_lake
    properties:
      name: lake
      location: us-west1
      project: my-project-name
  basicZone:
    type: gcp:dataplex:Zone
    name: basic_zone
    properties:
      name: zone
      location: us-west1
      lake: ${basicLake.name}
      type: RAW
      discoverySpec:
        enabled: false
      resourceSpec:
        locationType: SINGLE_REGION
      project: my-project-name
  primary:
    type: gcp:dataplex:Asset
    properties:
      name: asset
      location: us-west1
      lake: ${basicLake.name}
      dataplexZone: ${basicZone.name}
      discoverySpec:
        enabled: false
      resourceSpec:
        name: projects/my-project-name/buckets/bucket
        type: STORAGE_BUCKET
      labels:
        env: foo
        my-asset: exists
      project: my-project-name
    options:
      dependsOn:
        - ${basicBucket}

Import

Asset can be imported using any of these accepted formats:

  • projects/{{project}}/locations/{{location}}/lakes/{{lake}}/zones/{{dataplex_zone}}/assets/{{name}}
  • {{project}}/{{location}}/{{lake}}/{{dataplex_zone}}/{{name}}
  • {{location}}/{{lake}}/{{dataplex_zone}}/{{name}}

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

$ pulumi import gcp:dataplex/asset:Asset default projects/{{project}}/locations/{{location}}/lakes/{{lake}}/zones/{{dataplex_zone}}/assets/{{name}}
$ pulumi import gcp:dataplex/asset:Asset default {{project}}/{{location}}/{{lake}}/{{dataplex_zone}}/{{name}}
$ pulumi import gcp:dataplex/asset:Asset default {{location}}/{{lake}}/{{dataplex_zone}}/{{name}}

Constructors

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

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
createTime ↔ Output<String>
Output only. The time when the asset was created.
latefinal
dataplexZone ↔ Output<String>
The zone for the resource
latefinal
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
description ↔ Output<String?>
Optional. Description of the asset.
latefinal
discoverySpec ↔ Output<AssetDiscoverySpec>
Required. Specification of the discovery feature applied to data referenced by this asset. When this spec is left unset, the asset will use the spec set on the parent zone.
latefinal
discoveryStatuses ↔ Output<List<AssetDiscoveryStatus>>
Output only. Status of the discovery feature applied to data referenced by this asset.
latefinal
displayName ↔ Output<String?>
Optional. User friendly display name.
latefinal
effectiveLabels ↔ Output<Map<String, String>>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
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
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
labels ↔ Output<Map<String, String>?>
Optional. User defined labels for the asset.
latefinal
lake ↔ Output<String>
The lake for the resource
latefinal
location ↔ Output<String>
The location for the resource
latefinal
name ↔ Output<String>
The name of the asset.
latefinal
project ↔ Output<String>
The project for the resource
latefinal
pulumiLabels ↔ Output<Map<String, String>>
The combination of labels configured directly on the resource and default labels configured on the provider.
latefinal
resourceSpec ↔ Output<AssetResourceSpec>
Required. Immutable. Specification of the resource that is referenced by this asset.
latefinal
resourceStatuses ↔ Output<List<AssetResourceStatus>>
Output only. Status of the resource referenced by this asset.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
securityStatuses ↔ Output<List<AssetSecurityStatus>>
Output only. Status of the security policy applied to resource referenced by this asset.
latefinal
state ↔ Output<String>
Output only. Current state of the asset. Possible values: STATE_UNSPECIFIED, ACTIVE, CREATING, DELETING, ACTION_REQUIRED
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
uid ↔ Output<String>
Output only. System generated globally unique ID for the asset. This ID will be different if the asset is deleted and re-created with the same name.
latefinal
updateTime ↔ Output<String>
Output only. The time when the asset was last updated.
latefinal
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, {AssetState? state, CustomResourceOptions? options}) → Asset
Gets an existing Asset resource's state with the given name and id.