1. Packages
  2. Harness Provider
  3. API Docs
  4. platform
  5. EnvironmentClustersMapping
Harness v0.7.2 published on Tuesday, Apr 15, 2025 by Pulumi

harness.platform.EnvironmentClustersMapping

Explore with Pulumi AI

Resource for mapping environment with Harness Clusters.

Example Usage

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

// mapping a cluster to a project level env
const example = new harness.platform.EnvironmentClustersMapping("example", {
    identifier: "mycustomidentifier",
    orgId: "orgIdentifer",
    projectId: "projectIdentifier",
    envId: "exampleEnvId",
    clusters: [{
        identifier: "incluster",
        name: "in-cluster",
        agentIdentifier: "account.gitopsagentdev",
        scope: "ACCOUNT",
    }],
});
// mapping two clusters to account level env
const example2 = new harness.platform.EnvironmentClustersMapping("example2", {
    identifier: "mycustomidentifier",
    envId: "env1",
    clusters: [
        {
            identifier: "clusterA",
            name: "cluster-A",
            agentIdentifier: "account.gitopsagentprod",
            scope: "ACCOUNT",
        },
        {
            identifier: "clusterB",
            name: "cluster-B",
            agentIdentifier: "account.gitopsagentprod",
            scope: "ACCOUNT",
        },
    ],
});
Copy
import pulumi
import pulumi_harness as harness

# mapping a cluster to a project level env
example = harness.platform.EnvironmentClustersMapping("example",
    identifier="mycustomidentifier",
    org_id="orgIdentifer",
    project_id="projectIdentifier",
    env_id="exampleEnvId",
    clusters=[{
        "identifier": "incluster",
        "name": "in-cluster",
        "agent_identifier": "account.gitopsagentdev",
        "scope": "ACCOUNT",
    }])
# mapping two clusters to account level env
example2 = harness.platform.EnvironmentClustersMapping("example2",
    identifier="mycustomidentifier",
    env_id="env1",
    clusters=[
        {
            "identifier": "clusterA",
            "name": "cluster-A",
            "agent_identifier": "account.gitopsagentprod",
            "scope": "ACCOUNT",
        },
        {
            "identifier": "clusterB",
            "name": "cluster-B",
            "agent_identifier": "account.gitopsagentprod",
            "scope": "ACCOUNT",
        },
    ])
Copy
package main

import (
	"github.com/pulumi/pulumi-harness/sdk/go/harness/platform"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// mapping a cluster to a project level env
		_, err := platform.NewEnvironmentClustersMapping(ctx, "example", &platform.EnvironmentClustersMappingArgs{
			Identifier: pulumi.String("mycustomidentifier"),
			OrgId:      pulumi.String("orgIdentifer"),
			ProjectId:  pulumi.String("projectIdentifier"),
			EnvId:      pulumi.String("exampleEnvId"),
			Clusters: platform.EnvironmentClustersMappingClusterArray{
				&platform.EnvironmentClustersMappingClusterArgs{
					Identifier:      pulumi.String("incluster"),
					Name:            pulumi.String("in-cluster"),
					AgentIdentifier: pulumi.String("account.gitopsagentdev"),
					Scope:           pulumi.String("ACCOUNT"),
				},
			},
		})
		if err != nil {
			return err
		}
		// mapping two clusters to account level env
		_, err = platform.NewEnvironmentClustersMapping(ctx, "example2", &platform.EnvironmentClustersMappingArgs{
			Identifier: pulumi.String("mycustomidentifier"),
			EnvId:      pulumi.String("env1"),
			Clusters: platform.EnvironmentClustersMappingClusterArray{
				&platform.EnvironmentClustersMappingClusterArgs{
					Identifier:      pulumi.String("clusterA"),
					Name:            pulumi.String("cluster-A"),
					AgentIdentifier: pulumi.String("account.gitopsagentprod"),
					Scope:           pulumi.String("ACCOUNT"),
				},
				&platform.EnvironmentClustersMappingClusterArgs{
					Identifier:      pulumi.String("clusterB"),
					Name:            pulumi.String("cluster-B"),
					AgentIdentifier: pulumi.String("account.gitopsagentprod"),
					Scope:           pulumi.String("ACCOUNT"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;

return await Deployment.RunAsync(() => 
{
    // mapping a cluster to a project level env
    var example = new Harness.Platform.EnvironmentClustersMapping("example", new()
    {
        Identifier = "mycustomidentifier",
        OrgId = "orgIdentifer",
        ProjectId = "projectIdentifier",
        EnvId = "exampleEnvId",
        Clusters = new[]
        {
            new Harness.Platform.Inputs.EnvironmentClustersMappingClusterArgs
            {
                Identifier = "incluster",
                Name = "in-cluster",
                AgentIdentifier = "account.gitopsagentdev",
                Scope = "ACCOUNT",
            },
        },
    });

    // mapping two clusters to account level env
    var example2 = new Harness.Platform.EnvironmentClustersMapping("example2", new()
    {
        Identifier = "mycustomidentifier",
        EnvId = "env1",
        Clusters = new[]
        {
            new Harness.Platform.Inputs.EnvironmentClustersMappingClusterArgs
            {
                Identifier = "clusterA",
                Name = "cluster-A",
                AgentIdentifier = "account.gitopsagentprod",
                Scope = "ACCOUNT",
            },
            new Harness.Platform.Inputs.EnvironmentClustersMappingClusterArgs
            {
                Identifier = "clusterB",
                Name = "cluster-B",
                AgentIdentifier = "account.gitopsagentprod",
                Scope = "ACCOUNT",
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.platform.EnvironmentClustersMapping;
import com.pulumi.harness.platform.EnvironmentClustersMappingArgs;
import com.pulumi.harness.platform.inputs.EnvironmentClustersMappingClusterArgs;
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) {
        // mapping a cluster to a project level env
        var example = new EnvironmentClustersMapping("example", EnvironmentClustersMappingArgs.builder()
            .identifier("mycustomidentifier")
            .orgId("orgIdentifer")
            .projectId("projectIdentifier")
            .envId("exampleEnvId")
            .clusters(EnvironmentClustersMappingClusterArgs.builder()
                .identifier("incluster")
                .name("in-cluster")
                .agentIdentifier("account.gitopsagentdev")
                .scope("ACCOUNT")
                .build())
            .build());

        // mapping two clusters to account level env
        var example2 = new EnvironmentClustersMapping("example2", EnvironmentClustersMappingArgs.builder()
            .identifier("mycustomidentifier")
            .envId("env1")
            .clusters(            
                EnvironmentClustersMappingClusterArgs.builder()
                    .identifier("clusterA")
                    .name("cluster-A")
                    .agentIdentifier("account.gitopsagentprod")
                    .scope("ACCOUNT")
                    .build(),
                EnvironmentClustersMappingClusterArgs.builder()
                    .identifier("clusterB")
                    .name("cluster-B")
                    .agentIdentifier("account.gitopsagentprod")
                    .scope("ACCOUNT")
                    .build())
            .build());

    }
}
Copy
resources:
  # mapping a cluster to a project level env
  example:
    type: harness:platform:EnvironmentClustersMapping
    properties:
      identifier: mycustomidentifier
      orgId: orgIdentifer
      projectId: projectIdentifier
      envId: exampleEnvId
      clusters:
        - identifier: incluster
          name: in-cluster
          agentIdentifier: account.gitopsagentdev
          scope: ACCOUNT
  # mapping two clusters to account level env
  example2:
    type: harness:platform:EnvironmentClustersMapping
    properties:
      identifier: mycustomidentifier
      envId: env1
      clusters:
        - identifier: clusterA
          name: cluster-A
          agentIdentifier: account.gitopsagentprod
          scope: ACCOUNT
        - identifier: clusterB
          name: cluster-B
          agentIdentifier: account.gitopsagentprod
          scope: ACCOUNT
Copy

Create EnvironmentClustersMapping Resource

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

Constructor syntax

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

@overload
def EnvironmentClustersMapping(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               env_id: Optional[str] = None,
                               identifier: Optional[str] = None,
                               clusters: Optional[Sequence[EnvironmentClustersMappingClusterArgs]] = None,
                               org_id: Optional[str] = None,
                               project_id: Optional[str] = None)
func NewEnvironmentClustersMapping(ctx *Context, name string, args EnvironmentClustersMappingArgs, opts ...ResourceOption) (*EnvironmentClustersMapping, error)
public EnvironmentClustersMapping(string name, EnvironmentClustersMappingArgs args, CustomResourceOptions? opts = null)
public EnvironmentClustersMapping(String name, EnvironmentClustersMappingArgs args)
public EnvironmentClustersMapping(String name, EnvironmentClustersMappingArgs args, CustomResourceOptions options)
type: harness:platform:EnvironmentClustersMapping
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. EnvironmentClustersMappingArgs
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. EnvironmentClustersMappingArgs
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. EnvironmentClustersMappingArgs
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. EnvironmentClustersMappingArgs
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. EnvironmentClustersMappingArgs
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 environmentClustersMappingResource = new Harness.Platform.EnvironmentClustersMapping("environmentClustersMappingResource", new()
{
    EnvId = "string",
    Identifier = "string",
    Clusters = new[]
    {
        new Harness.Platform.Inputs.EnvironmentClustersMappingClusterArgs
        {
            AgentIdentifier = "string",
            Identifier = "string",
            Name = "string",
            Scope = "string",
        },
    },
    OrgId = "string",
    ProjectId = "string",
});
Copy
example, err := platform.NewEnvironmentClustersMapping(ctx, "environmentClustersMappingResource", &platform.EnvironmentClustersMappingArgs{
	EnvId:      pulumi.String("string"),
	Identifier: pulumi.String("string"),
	Clusters: platform.EnvironmentClustersMappingClusterArray{
		&platform.EnvironmentClustersMappingClusterArgs{
			AgentIdentifier: pulumi.String("string"),
			Identifier:      pulumi.String("string"),
			Name:            pulumi.String("string"),
			Scope:           pulumi.String("string"),
		},
	},
	OrgId:     pulumi.String("string"),
	ProjectId: pulumi.String("string"),
})
Copy
var environmentClustersMappingResource = new EnvironmentClustersMapping("environmentClustersMappingResource", EnvironmentClustersMappingArgs.builder()
    .envId("string")
    .identifier("string")
    .clusters(EnvironmentClustersMappingClusterArgs.builder()
        .agentIdentifier("string")
        .identifier("string")
        .name("string")
        .scope("string")
        .build())
    .orgId("string")
    .projectId("string")
    .build());
Copy
environment_clusters_mapping_resource = harness.platform.EnvironmentClustersMapping("environmentClustersMappingResource",
    env_id="string",
    identifier="string",
    clusters=[{
        "agent_identifier": "string",
        "identifier": "string",
        "name": "string",
        "scope": "string",
    }],
    org_id="string",
    project_id="string")
Copy
const environmentClustersMappingResource = new harness.platform.EnvironmentClustersMapping("environmentClustersMappingResource", {
    envId: "string",
    identifier: "string",
    clusters: [{
        agentIdentifier: "string",
        identifier: "string",
        name: "string",
        scope: "string",
    }],
    orgId: "string",
    projectId: "string",
});
Copy
type: harness:platform:EnvironmentClustersMapping
properties:
    clusters:
        - agentIdentifier: string
          identifier: string
          name: string
          scope: string
    envId: string
    identifier: string
    orgId: string
    projectId: string
Copy

EnvironmentClustersMapping 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 EnvironmentClustersMapping resource accepts the following input properties:

EnvId This property is required. string
environment identifier.
Identifier This property is required. string
identifier for the cluster mapping(can be given any value).
Clusters List<EnvironmentClustersMappingCluster>
list of cluster identifiers and names
OrgId string
org_id of the environment.
ProjectId string
project_id of the environment.
EnvId This property is required. string
environment identifier.
Identifier This property is required. string
identifier for the cluster mapping(can be given any value).
Clusters []EnvironmentClustersMappingClusterArgs
list of cluster identifiers and names
OrgId string
org_id of the environment.
ProjectId string
project_id of the environment.
envId This property is required. String
environment identifier.
identifier This property is required. String
identifier for the cluster mapping(can be given any value).
clusters List<EnvironmentClustersMappingCluster>
list of cluster identifiers and names
orgId String
org_id of the environment.
projectId String
project_id of the environment.
envId This property is required. string
environment identifier.
identifier This property is required. string
identifier for the cluster mapping(can be given any value).
clusters EnvironmentClustersMappingCluster[]
list of cluster identifiers and names
orgId string
org_id of the environment.
projectId string
project_id of the environment.
env_id This property is required. str
environment identifier.
identifier This property is required. str
identifier for the cluster mapping(can be given any value).
clusters Sequence[EnvironmentClustersMappingClusterArgs]
list of cluster identifiers and names
org_id str
org_id of the environment.
project_id str
project_id of the environment.
envId This property is required. String
environment identifier.
identifier This property is required. String
identifier for the cluster mapping(can be given any value).
clusters List<Property Map>
list of cluster identifiers and names
orgId String
org_id of the environment.
projectId String
project_id of the environment.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Scope string
scope at which the environment exists in harness.
Id string
The provider-assigned unique ID for this managed resource.
Scope string
scope at which the environment exists in harness.
id String
The provider-assigned unique ID for this managed resource.
scope String
scope at which the environment exists in harness.
id string
The provider-assigned unique ID for this managed resource.
scope string
scope at which the environment exists in harness.
id str
The provider-assigned unique ID for this managed resource.
scope str
scope at which the environment exists in harness.
id String
The provider-assigned unique ID for this managed resource.
scope String
scope at which the environment exists in harness.

Look up Existing EnvironmentClustersMapping Resource

Get an existing EnvironmentClustersMapping 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?: EnvironmentClustersMappingState, opts?: CustomResourceOptions): EnvironmentClustersMapping
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        clusters: Optional[Sequence[EnvironmentClustersMappingClusterArgs]] = None,
        env_id: Optional[str] = None,
        identifier: Optional[str] = None,
        org_id: Optional[str] = None,
        project_id: Optional[str] = None,
        scope: Optional[str] = None) -> EnvironmentClustersMapping
func GetEnvironmentClustersMapping(ctx *Context, name string, id IDInput, state *EnvironmentClustersMappingState, opts ...ResourceOption) (*EnvironmentClustersMapping, error)
public static EnvironmentClustersMapping Get(string name, Input<string> id, EnvironmentClustersMappingState? state, CustomResourceOptions? opts = null)
public static EnvironmentClustersMapping get(String name, Output<String> id, EnvironmentClustersMappingState state, CustomResourceOptions options)
resources:  _:    type: harness:platform:EnvironmentClustersMapping    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:
Clusters List<EnvironmentClustersMappingCluster>
list of cluster identifiers and names
EnvId string
environment identifier.
Identifier string
identifier for the cluster mapping(can be given any value).
OrgId string
org_id of the environment.
ProjectId string
project_id of the environment.
Scope string
scope at which the environment exists in harness.
Clusters []EnvironmentClustersMappingClusterArgs
list of cluster identifiers and names
EnvId string
environment identifier.
Identifier string
identifier for the cluster mapping(can be given any value).
OrgId string
org_id of the environment.
ProjectId string
project_id of the environment.
Scope string
scope at which the environment exists in harness.
clusters List<EnvironmentClustersMappingCluster>
list of cluster identifiers and names
envId String
environment identifier.
identifier String
identifier for the cluster mapping(can be given any value).
orgId String
org_id of the environment.
projectId String
project_id of the environment.
scope String
scope at which the environment exists in harness.
clusters EnvironmentClustersMappingCluster[]
list of cluster identifiers and names
envId string
environment identifier.
identifier string
identifier for the cluster mapping(can be given any value).
orgId string
org_id of the environment.
projectId string
project_id of the environment.
scope string
scope at which the environment exists in harness.
clusters Sequence[EnvironmentClustersMappingClusterArgs]
list of cluster identifiers and names
env_id str
environment identifier.
identifier str
identifier for the cluster mapping(can be given any value).
org_id str
org_id of the environment.
project_id str
project_id of the environment.
scope str
scope at which the environment exists in harness.
clusters List<Property Map>
list of cluster identifiers and names
envId String
environment identifier.
identifier String
identifier for the cluster mapping(can be given any value).
orgId String
org_id of the environment.
projectId String
project_id of the environment.
scope String
scope at which the environment exists in harness.

Supporting Types

EnvironmentClustersMappingCluster
, EnvironmentClustersMappingClusterArgs

AgentIdentifier string
agent identifier of the cluster (include scope prefix)
Identifier string
identifier of the cluster
Name string
name of the cluster
Scope string
scope at which the cluster exists in harness gitops, one of "ACCOUNT", "ORGANIZATION", "PROJECT". Scope of environment to which clusters are being mapped must be lower or equal to in hierarchy than the scope of the cluster
AgentIdentifier string
agent identifier of the cluster (include scope prefix)
Identifier string
identifier of the cluster
Name string
name of the cluster
Scope string
scope at which the cluster exists in harness gitops, one of "ACCOUNT", "ORGANIZATION", "PROJECT". Scope of environment to which clusters are being mapped must be lower or equal to in hierarchy than the scope of the cluster
agentIdentifier String
agent identifier of the cluster (include scope prefix)
identifier String
identifier of the cluster
name String
name of the cluster
scope String
scope at which the cluster exists in harness gitops, one of "ACCOUNT", "ORGANIZATION", "PROJECT". Scope of environment to which clusters are being mapped must be lower or equal to in hierarchy than the scope of the cluster
agentIdentifier string
agent identifier of the cluster (include scope prefix)
identifier string
identifier of the cluster
name string
name of the cluster
scope string
scope at which the cluster exists in harness gitops, one of "ACCOUNT", "ORGANIZATION", "PROJECT". Scope of environment to which clusters are being mapped must be lower or equal to in hierarchy than the scope of the cluster
agent_identifier str
agent identifier of the cluster (include scope prefix)
identifier str
identifier of the cluster
name str
name of the cluster
scope str
scope at which the cluster exists in harness gitops, one of "ACCOUNT", "ORGANIZATION", "PROJECT". Scope of environment to which clusters are being mapped must be lower or equal to in hierarchy than the scope of the cluster
agentIdentifier String
agent identifier of the cluster (include scope prefix)
identifier String
identifier of the cluster
name String
name of the cluster
scope String
scope at which the cluster exists in harness gitops, one of "ACCOUNT", "ORGANIZATION", "PROJECT". Scope of environment to which clusters are being mapped must be lower or equal to in hierarchy than the scope of the cluster

Package Details

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