1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. ContainerEngine
  5. ClusterWorkloadMapping
Oracle Cloud Infrastructure v2.31.0 published on Thursday, Apr 17, 2025 by Pulumi

oci.ContainerEngine.ClusterWorkloadMapping

Explore with Pulumi AI

This resource provides the Cluster Workload Mapping resource in Oracle Cloud Infrastructure Container Engine service.

Create the specified workloadMapping for a cluster.

Example Usage

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

const testClusterWorkloadMapping = new oci.containerengine.ClusterWorkloadMapping("test_cluster_workload_mapping", {
    clusterId: testCluster.id,
    mappedCompartmentId: testCompartment.id,
    namespace: clusterWorkloadMappingNamespace,
    definedTags: {
        "Operations.CostCenter": "42",
    },
    freeformTags: {
        Department: "Finance",
    },
});
Copy
import pulumi
import pulumi_oci as oci

test_cluster_workload_mapping = oci.container_engine.ClusterWorkloadMapping("test_cluster_workload_mapping",
    cluster_id=test_cluster["id"],
    mapped_compartment_id=test_compartment["id"],
    namespace=cluster_workload_mapping_namespace,
    defined_tags={
        "Operations.CostCenter": "42",
    },
    freeform_tags={
        "Department": "Finance",
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/containerengine"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := containerengine.NewClusterWorkloadMapping(ctx, "test_cluster_workload_mapping", &containerengine.ClusterWorkloadMappingArgs{
			ClusterId:           pulumi.Any(testCluster.Id),
			MappedCompartmentId: pulumi.Any(testCompartment.Id),
			Namespace:           pulumi.Any(clusterWorkloadMappingNamespace),
			DefinedTags: pulumi.StringMap{
				"Operations.CostCenter": pulumi.String("42"),
			},
			FreeformTags: pulumi.StringMap{
				"Department": pulumi.String("Finance"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;

return await Deployment.RunAsync(() => 
{
    var testClusterWorkloadMapping = new Oci.ContainerEngine.ClusterWorkloadMapping("test_cluster_workload_mapping", new()
    {
        ClusterId = testCluster.Id,
        MappedCompartmentId = testCompartment.Id,
        Namespace = clusterWorkloadMappingNamespace,
        DefinedTags = 
        {
            { "Operations.CostCenter", "42" },
        },
        FreeformTags = 
        {
            { "Department", "Finance" },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.ContainerEngine.ClusterWorkloadMapping;
import com.pulumi.oci.ContainerEngine.ClusterWorkloadMappingArgs;
import java.util.List;
import java.util.ArrayList;
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 testClusterWorkloadMapping = new ClusterWorkloadMapping("testClusterWorkloadMapping", ClusterWorkloadMappingArgs.builder()
            .clusterId(testCluster.id())
            .mappedCompartmentId(testCompartment.id())
            .namespace(clusterWorkloadMappingNamespace)
            .definedTags(Map.of("Operations.CostCenter", "42"))
            .freeformTags(Map.of("Department", "Finance"))
            .build());

    }
}
Copy
resources:
  testClusterWorkloadMapping:
    type: oci:ContainerEngine:ClusterWorkloadMapping
    name: test_cluster_workload_mapping
    properties:
      clusterId: ${testCluster.id}
      mappedCompartmentId: ${testCompartment.id}
      namespace: ${clusterWorkloadMappingNamespace}
      definedTags:
        Operations.CostCenter: '42'
      freeformTags:
        Department: Finance
Copy

Create ClusterWorkloadMapping Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ClusterWorkloadMapping(name: string, args: ClusterWorkloadMappingArgs, opts?: CustomResourceOptions);
@overload
def ClusterWorkloadMapping(resource_name: str,
                           args: ClusterWorkloadMappingArgs,
                           opts: Optional[ResourceOptions] = None)

@overload
def ClusterWorkloadMapping(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           cluster_id: Optional[str] = None,
                           mapped_compartment_id: Optional[str] = None,
                           namespace: Optional[str] = None,
                           defined_tags: Optional[Mapping[str, str]] = None,
                           freeform_tags: Optional[Mapping[str, str]] = None)
func NewClusterWorkloadMapping(ctx *Context, name string, args ClusterWorkloadMappingArgs, opts ...ResourceOption) (*ClusterWorkloadMapping, error)
public ClusterWorkloadMapping(string name, ClusterWorkloadMappingArgs args, CustomResourceOptions? opts = null)
public ClusterWorkloadMapping(String name, ClusterWorkloadMappingArgs args)
public ClusterWorkloadMapping(String name, ClusterWorkloadMappingArgs args, CustomResourceOptions options)
type: oci:ContainerEngine:ClusterWorkloadMapping
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ClusterWorkloadMappingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ClusterWorkloadMappingArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ClusterWorkloadMappingArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ClusterWorkloadMappingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ClusterWorkloadMappingArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var clusterWorkloadMappingResource = new Oci.ContainerEngine.ClusterWorkloadMapping("clusterWorkloadMappingResource", new()
{
    ClusterId = "string",
    MappedCompartmentId = "string",
    Namespace = "string",
    DefinedTags = 
    {
        { "string", "string" },
    },
    FreeformTags = 
    {
        { "string", "string" },
    },
});
Copy
example, err := ContainerEngine.NewClusterWorkloadMapping(ctx, "clusterWorkloadMappingResource", &ContainerEngine.ClusterWorkloadMappingArgs{
	ClusterId:           pulumi.String("string"),
	MappedCompartmentId: pulumi.String("string"),
	Namespace:           pulumi.String("string"),
	DefinedTags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	FreeformTags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
Copy
var clusterWorkloadMappingResource = new ClusterWorkloadMapping("clusterWorkloadMappingResource", ClusterWorkloadMappingArgs.builder()
    .clusterId("string")
    .mappedCompartmentId("string")
    .namespace("string")
    .definedTags(Map.of("string", "string"))
    .freeformTags(Map.of("string", "string"))
    .build());
Copy
cluster_workload_mapping_resource = oci.container_engine.ClusterWorkloadMapping("clusterWorkloadMappingResource",
    cluster_id="string",
    mapped_compartment_id="string",
    namespace="string",
    defined_tags={
        "string": "string",
    },
    freeform_tags={
        "string": "string",
    })
Copy
const clusterWorkloadMappingResource = new oci.containerengine.ClusterWorkloadMapping("clusterWorkloadMappingResource", {
    clusterId: "string",
    mappedCompartmentId: "string",
    namespace: "string",
    definedTags: {
        string: "string",
    },
    freeformTags: {
        string: "string",
    },
});
Copy
type: oci:ContainerEngine:ClusterWorkloadMapping
properties:
    clusterId: string
    definedTags:
        string: string
    freeformTags:
        string: string
    mappedCompartmentId: string
    namespace: string
Copy

ClusterWorkloadMapping Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ClusterWorkloadMapping resource accepts the following input properties:

ClusterId
This property is required.
Changes to this property will trigger replacement.
string
The OCID of the cluster.
MappedCompartmentId This property is required. string
(Updatable) The OCID of the mapped customer compartment.
Namespace
This property is required.
Changes to this property will trigger replacement.
string

The namespace of the workloadMapping.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

DefinedTags Dictionary<string, string>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
FreeformTags Dictionary<string, string>
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
ClusterId
This property is required.
Changes to this property will trigger replacement.
string
The OCID of the cluster.
MappedCompartmentId This property is required. string
(Updatable) The OCID of the mapped customer compartment.
Namespace
This property is required.
Changes to this property will trigger replacement.
string

The namespace of the workloadMapping.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

DefinedTags map[string]string
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
FreeformTags map[string]string
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
clusterId
This property is required.
Changes to this property will trigger replacement.
String
The OCID of the cluster.
mappedCompartmentId This property is required. String
(Updatable) The OCID of the mapped customer compartment.
namespace
This property is required.
Changes to this property will trigger replacement.
String

The namespace of the workloadMapping.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

definedTags Map<String,String>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
freeformTags Map<String,String>
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
clusterId
This property is required.
Changes to this property will trigger replacement.
string
The OCID of the cluster.
mappedCompartmentId This property is required. string
(Updatable) The OCID of the mapped customer compartment.
namespace
This property is required.
Changes to this property will trigger replacement.
string

The namespace of the workloadMapping.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

definedTags {[key: string]: string}
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
freeformTags {[key: string]: string}
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
cluster_id
This property is required.
Changes to this property will trigger replacement.
str
The OCID of the cluster.
mapped_compartment_id This property is required. str
(Updatable) The OCID of the mapped customer compartment.
namespace
This property is required.
Changes to this property will trigger replacement.
str

The namespace of the workloadMapping.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

defined_tags Mapping[str, str]
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
freeform_tags Mapping[str, str]
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
clusterId
This property is required.
Changes to this property will trigger replacement.
String
The OCID of the cluster.
mappedCompartmentId This property is required. String
(Updatable) The OCID of the mapped customer compartment.
namespace
This property is required.
Changes to this property will trigger replacement.
String

The namespace of the workloadMapping.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

definedTags Map<String>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
freeformTags Map<String>
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

Outputs

All input properties are implicitly available as output properties. Additionally, the ClusterWorkloadMapping resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
MappedTenancyId string
The OCID of the mapped customer tenancy.
State string
The state of the workloadMapping.
TimeCreated string
The time the cluster was created.
Id string
The provider-assigned unique ID for this managed resource.
MappedTenancyId string
The OCID of the mapped customer tenancy.
State string
The state of the workloadMapping.
TimeCreated string
The time the cluster was created.
id String
The provider-assigned unique ID for this managed resource.
mappedTenancyId String
The OCID of the mapped customer tenancy.
state String
The state of the workloadMapping.
timeCreated String
The time the cluster was created.
id string
The provider-assigned unique ID for this managed resource.
mappedTenancyId string
The OCID of the mapped customer tenancy.
state string
The state of the workloadMapping.
timeCreated string
The time the cluster was created.
id str
The provider-assigned unique ID for this managed resource.
mapped_tenancy_id str
The OCID of the mapped customer tenancy.
state str
The state of the workloadMapping.
time_created str
The time the cluster was created.
id String
The provider-assigned unique ID for this managed resource.
mappedTenancyId String
The OCID of the mapped customer tenancy.
state String
The state of the workloadMapping.
timeCreated String
The time the cluster was created.

Look up Existing ClusterWorkloadMapping Resource

Get an existing ClusterWorkloadMapping resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ClusterWorkloadMappingState, opts?: CustomResourceOptions): ClusterWorkloadMapping
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cluster_id: Optional[str] = None,
        defined_tags: Optional[Mapping[str, str]] = None,
        freeform_tags: Optional[Mapping[str, str]] = None,
        mapped_compartment_id: Optional[str] = None,
        mapped_tenancy_id: Optional[str] = None,
        namespace: Optional[str] = None,
        state: Optional[str] = None,
        time_created: Optional[str] = None) -> ClusterWorkloadMapping
func GetClusterWorkloadMapping(ctx *Context, name string, id IDInput, state *ClusterWorkloadMappingState, opts ...ResourceOption) (*ClusterWorkloadMapping, error)
public static ClusterWorkloadMapping Get(string name, Input<string> id, ClusterWorkloadMappingState? state, CustomResourceOptions? opts = null)
public static ClusterWorkloadMapping get(String name, Output<String> id, ClusterWorkloadMappingState state, CustomResourceOptions options)
resources:  _:    type: oci:ContainerEngine:ClusterWorkloadMapping    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ClusterId Changes to this property will trigger replacement. string
The OCID of the cluster.
DefinedTags Dictionary<string, string>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
FreeformTags Dictionary<string, string>
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
MappedCompartmentId string
(Updatable) The OCID of the mapped customer compartment.
MappedTenancyId string
The OCID of the mapped customer tenancy.
Namespace Changes to this property will trigger replacement. string

The namespace of the workloadMapping.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

State string
The state of the workloadMapping.
TimeCreated string
The time the cluster was created.
ClusterId Changes to this property will trigger replacement. string
The OCID of the cluster.
DefinedTags map[string]string
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
FreeformTags map[string]string
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
MappedCompartmentId string
(Updatable) The OCID of the mapped customer compartment.
MappedTenancyId string
The OCID of the mapped customer tenancy.
Namespace Changes to this property will trigger replacement. string

The namespace of the workloadMapping.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

State string
The state of the workloadMapping.
TimeCreated string
The time the cluster was created.
clusterId Changes to this property will trigger replacement. String
The OCID of the cluster.
definedTags Map<String,String>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
freeformTags Map<String,String>
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
mappedCompartmentId String
(Updatable) The OCID of the mapped customer compartment.
mappedTenancyId String
The OCID of the mapped customer tenancy.
namespace Changes to this property will trigger replacement. String

The namespace of the workloadMapping.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

state String
The state of the workloadMapping.
timeCreated String
The time the cluster was created.
clusterId Changes to this property will trigger replacement. string
The OCID of the cluster.
definedTags {[key: string]: string}
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
freeformTags {[key: string]: string}
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
mappedCompartmentId string
(Updatable) The OCID of the mapped customer compartment.
mappedTenancyId string
The OCID of the mapped customer tenancy.
namespace Changes to this property will trigger replacement. string

The namespace of the workloadMapping.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

state string
The state of the workloadMapping.
timeCreated string
The time the cluster was created.
cluster_id Changes to this property will trigger replacement. str
The OCID of the cluster.
defined_tags Mapping[str, str]
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
freeform_tags Mapping[str, str]
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
mapped_compartment_id str
(Updatable) The OCID of the mapped customer compartment.
mapped_tenancy_id str
The OCID of the mapped customer tenancy.
namespace Changes to this property will trigger replacement. str

The namespace of the workloadMapping.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

state str
The state of the workloadMapping.
time_created str
The time the cluster was created.
clusterId Changes to this property will trigger replacement. String
The OCID of the cluster.
definedTags Map<String>
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
freeformTags Map<String>
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
mappedCompartmentId String
(Updatable) The OCID of the mapped customer compartment.
mappedTenancyId String
The OCID of the mapped customer tenancy.
namespace Changes to this property will trigger replacement. String

The namespace of the workloadMapping.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

state String
The state of the workloadMapping.
timeCreated String
The time the cluster was created.

Import

ClusterWorkloadMappings can be imported using the id, e.g.

$ pulumi import oci:ContainerEngine/clusterWorkloadMapping:ClusterWorkloadMapping test_cluster_workload_mapping "clusters/{clusterId}/workloadMappings/{workloadMappingId}"
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
oci pulumi/pulumi-oci
License
Apache-2.0
Notes
This Pulumi package is based on the oci Terraform Provider.