1. Packages
  2. Harness Provider
  3. API Docs
  4. platform
  5. getEnvironmentClustersMapping
Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi

harness.platform.getEnvironmentClustersMapping

Explore with Pulumi AI

harness logo
Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi

    Data source for retrieving Harness Gitops clusters mapped to Harness Environment.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as harness from "@pulumi/harness";
    
    // data source for gitops clusters mapped to a project level env
    const example = harness.platform.getEnvironmentClustersMapping({
        identifier: "mycustomidentifier",
        orgId: "orgIdentifer",
        projectId: "projectIdentifier",
        envId: "exampleEnvId",
        clusters: [{
            identifier: "incluster",
            name: "in-cluster",
            agentIdentifier: "account.gitopsagentdev",
            scope: "ACCOUNT",
        }],
    });
    // data source for two gitops clusters mapped to an account level env
    const example2 = harness.platform.getEnvironmentClustersMapping({
        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",
            },
        ],
    });
    
    import pulumi
    import pulumi_harness as harness
    
    # data source for gitops clusters mapped to a project level env
    example = harness.platform.get_environment_clusters_mapping(identifier="mycustomidentifier",
        org_id="orgIdentifer",
        project_id="projectIdentifier",
        env_id="exampleEnvId",
        clusters=[{
            "identifier": "incluster",
            "name": "in-cluster",
            "agent_identifier": "account.gitopsagentdev",
            "scope": "ACCOUNT",
        }])
    # data source for two gitops clusters mapped to an account level env
    example2 = harness.platform.get_environment_clusters_mapping(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",
            },
        ])
    
    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 {
    		// data source for gitops clusters mapped to a project level env
    		_, err := platform.LookupEnvironmentClustersMapping(ctx, &platform.LookupEnvironmentClustersMappingArgs{
    			Identifier: "mycustomidentifier",
    			OrgId:      pulumi.StringRef("orgIdentifer"),
    			ProjectId:  pulumi.StringRef("projectIdentifier"),
    			EnvId:      "exampleEnvId",
    			Clusters: []platform.GetEnvironmentClustersMappingCluster{
    				{
    					Identifier:      pulumi.StringRef("incluster"),
    					Name:            pulumi.StringRef("in-cluster"),
    					AgentIdentifier: pulumi.StringRef("account.gitopsagentdev"),
    					Scope:           pulumi.StringRef("ACCOUNT"),
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// data source for two gitops clusters mapped to an account level env
    		_, err = platform.LookupEnvironmentClustersMapping(ctx, &platform.LookupEnvironmentClustersMappingArgs{
    			Identifier: "mycustomidentifier",
    			EnvId:      "env1",
    			Clusters: []platform.GetEnvironmentClustersMappingCluster{
    				{
    					Identifier:      pulumi.StringRef("clusterA"),
    					Name:            pulumi.StringRef("cluster-A"),
    					AgentIdentifier: pulumi.StringRef("account.gitopsagentprod"),
    					Scope:           pulumi.StringRef("ACCOUNT"),
    				},
    				{
    					Identifier:      pulumi.StringRef("clusterB"),
    					Name:            pulumi.StringRef("cluster-B"),
    					AgentIdentifier: pulumi.StringRef("account.gitopsagentprod"),
    					Scope:           pulumi.StringRef("ACCOUNT"),
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Harness = Pulumi.Harness;
    
    return await Deployment.RunAsync(() => 
    {
        // data source for gitops clusters mapped to a project level env
        var example = Harness.Platform.GetEnvironmentClustersMapping.Invoke(new()
        {
            Identifier = "mycustomidentifier",
            OrgId = "orgIdentifer",
            ProjectId = "projectIdentifier",
            EnvId = "exampleEnvId",
            Clusters = new[]
            {
                new Harness.Platform.Inputs.GetEnvironmentClustersMappingClusterInputArgs
                {
                    Identifier = "incluster",
                    Name = "in-cluster",
                    AgentIdentifier = "account.gitopsagentdev",
                    Scope = "ACCOUNT",
                },
            },
        });
    
        // data source for two gitops clusters mapped to an account level env
        var example2 = Harness.Platform.GetEnvironmentClustersMapping.Invoke(new()
        {
            Identifier = "mycustomidentifier",
            EnvId = "env1",
            Clusters = new[]
            {
                new Harness.Platform.Inputs.GetEnvironmentClustersMappingClusterInputArgs
                {
                    Identifier = "clusterA",
                    Name = "cluster-A",
                    AgentIdentifier = "account.gitopsagentprod",
                    Scope = "ACCOUNT",
                },
                new Harness.Platform.Inputs.GetEnvironmentClustersMappingClusterInputArgs
                {
                    Identifier = "clusterB",
                    Name = "cluster-B",
                    AgentIdentifier = "account.gitopsagentprod",
                    Scope = "ACCOUNT",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.harness.platform.PlatformFunctions;
    import com.pulumi.harness.platform.inputs.GetEnvironmentClustersMappingArgs;
    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) {
            // data source for gitops clusters mapped to a project level env
            final var example = PlatformFunctions.getEnvironmentClustersMapping(GetEnvironmentClustersMappingArgs.builder()
                .identifier("mycustomidentifier")
                .orgId("orgIdentifer")
                .projectId("projectIdentifier")
                .envId("exampleEnvId")
                .clusters(GetEnvironmentClustersMappingClusterArgs.builder()
                    .identifier("incluster")
                    .name("in-cluster")
                    .agentIdentifier("account.gitopsagentdev")
                    .scope("ACCOUNT")
                    .build())
                .build());
    
            // data source for two gitops clusters mapped to an account level env
            final var example2 = PlatformFunctions.getEnvironmentClustersMapping(GetEnvironmentClustersMappingArgs.builder()
                .identifier("mycustomidentifier")
                .envId("env1")
                .clusters(            
                    GetEnvironmentClustersMappingClusterArgs.builder()
                        .identifier("clusterA")
                        .name("cluster-A")
                        .agentIdentifier("account.gitopsagentprod")
                        .scope("ACCOUNT")
                        .build(),
                    GetEnvironmentClustersMappingClusterArgs.builder()
                        .identifier("clusterB")
                        .name("cluster-B")
                        .agentIdentifier("account.gitopsagentprod")
                        .scope("ACCOUNT")
                        .build())
                .build());
    
        }
    }
    
    variables:
      # data source for gitops clusters mapped to a project level env
      example:
        fn::invoke:
          Function: harness:platform:getEnvironmentClustersMapping
          Arguments:
            identifier: mycustomidentifier
            orgId: orgIdentifer
            projectId: projectIdentifier
            envId: exampleEnvId
            clusters:
              - identifier: incluster
                name: in-cluster
                agentIdentifier: account.gitopsagentdev
                scope: ACCOUNT
      # data source for two gitops clusters mapped to an account level env
      example2:
        fn::invoke:
          Function: harness:platform:getEnvironmentClustersMapping
          Arguments:
            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
    

    Using getEnvironmentClustersMapping

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getEnvironmentClustersMapping(args: GetEnvironmentClustersMappingArgs, opts?: InvokeOptions): Promise<GetEnvironmentClustersMappingResult>
    function getEnvironmentClustersMappingOutput(args: GetEnvironmentClustersMappingOutputArgs, opts?: InvokeOptions): Output<GetEnvironmentClustersMappingResult>
    def get_environment_clusters_mapping(clusters: Optional[Sequence[GetEnvironmentClustersMappingCluster]] = None,
                                         env_id: Optional[str] = None,
                                         identifier: Optional[str] = None,
                                         org_id: Optional[str] = None,
                                         project_id: Optional[str] = None,
                                         opts: Optional[InvokeOptions] = None) -> GetEnvironmentClustersMappingResult
    def get_environment_clusters_mapping_output(clusters: Optional[pulumi.Input[Sequence[pulumi.Input[GetEnvironmentClustersMappingClusterArgs]]]] = None,
                                         env_id: Optional[pulumi.Input[str]] = None,
                                         identifier: Optional[pulumi.Input[str]] = None,
                                         org_id: Optional[pulumi.Input[str]] = None,
                                         project_id: Optional[pulumi.Input[str]] = None,
                                         opts: Optional[InvokeOptions] = None) -> Output[GetEnvironmentClustersMappingResult]
    func LookupEnvironmentClustersMapping(ctx *Context, args *LookupEnvironmentClustersMappingArgs, opts ...InvokeOption) (*LookupEnvironmentClustersMappingResult, error)
    func LookupEnvironmentClustersMappingOutput(ctx *Context, args *LookupEnvironmentClustersMappingOutputArgs, opts ...InvokeOption) LookupEnvironmentClustersMappingResultOutput

    > Note: This function is named LookupEnvironmentClustersMapping in the Go SDK.

    public static class GetEnvironmentClustersMapping 
    {
        public static Task<GetEnvironmentClustersMappingResult> InvokeAsync(GetEnvironmentClustersMappingArgs args, InvokeOptions? opts = null)
        public static Output<GetEnvironmentClustersMappingResult> Invoke(GetEnvironmentClustersMappingInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetEnvironmentClustersMappingResult> getEnvironmentClustersMapping(GetEnvironmentClustersMappingArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: harness:platform/getEnvironmentClustersMapping:getEnvironmentClustersMapping
      arguments:
        # arguments dictionary

    The following arguments are supported:

    EnvId string
    environment identifier.
    Identifier string
    identifier for the cluster mapping(can be given any value).
    Clusters List<GetEnvironmentClustersMappingCluster>
    list of cluster identifiers and names
    OrgId string
    org_id of the environment.
    ProjectId string
    project_id of the environment.
    EnvId string
    environment identifier.
    Identifier string
    identifier for the cluster mapping(can be given any value).
    Clusters []GetEnvironmentClustersMappingCluster
    list of cluster identifiers and names
    OrgId string
    org_id of the environment.
    ProjectId string
    project_id of the environment.
    envId String
    environment identifier.
    identifier String
    identifier for the cluster mapping(can be given any value).
    clusters List<GetEnvironmentClustersMappingCluster>
    list of cluster identifiers and names
    orgId String
    org_id of the environment.
    projectId String
    project_id of the environment.
    envId string
    environment identifier.
    identifier string
    identifier for the cluster mapping(can be given any value).
    clusters GetEnvironmentClustersMappingCluster[]
    list of cluster identifiers and names
    orgId string
    org_id of the environment.
    projectId string
    project_id of the environment.
    env_id str
    environment identifier.
    identifier str
    identifier for the cluster mapping(can be given any value).
    clusters Sequence[GetEnvironmentClustersMappingCluster]
    list of cluster identifiers and names
    org_id str
    org_id of the environment.
    project_id str
    project_id of the environment.
    envId String
    environment identifier.
    identifier 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.

    getEnvironmentClustersMapping Result

    The following output properties are available:

    EnvId string
    environment identifier.
    Id string
    The provider-assigned unique ID for this managed resource.
    Identifier string
    identifier for the cluster mapping(can be given any value).
    Scope string
    scope at which the environment exists in harness.
    Clusters List<GetEnvironmentClustersMappingCluster>
    list of cluster identifiers and names
    OrgId string
    org_id of the environment.
    ProjectId string
    project_id of the environment.
    EnvId string
    environment identifier.
    Id string
    The provider-assigned unique ID for this managed resource.
    Identifier string
    identifier for the cluster mapping(can be given any value).
    Scope string
    scope at which the environment exists in harness.
    Clusters []GetEnvironmentClustersMappingCluster
    list of cluster identifiers and names
    OrgId string
    org_id of the environment.
    ProjectId string
    project_id of the environment.
    envId String
    environment identifier.
    id String
    The provider-assigned unique ID for this managed resource.
    identifier String
    identifier for the cluster mapping(can be given any value).
    scope String
    scope at which the environment exists in harness.
    clusters List<GetEnvironmentClustersMappingCluster>
    list of cluster identifiers and names
    orgId String
    org_id of the environment.
    projectId String
    project_id of the environment.
    envId string
    environment identifier.
    id string
    The provider-assigned unique ID for this managed resource.
    identifier string
    identifier for the cluster mapping(can be given any value).
    scope string
    scope at which the environment exists in harness.
    clusters GetEnvironmentClustersMappingCluster[]
    list of cluster identifiers and names
    orgId string
    org_id of the environment.
    projectId string
    project_id of the environment.
    env_id str
    environment identifier.
    id str
    The provider-assigned unique ID for this managed resource.
    identifier str
    identifier for the cluster mapping(can be given any value).
    scope str
    scope at which the environment exists in harness.
    clusters Sequence[GetEnvironmentClustersMappingCluster]
    list of cluster identifiers and names
    org_id str
    org_id of the environment.
    project_id str
    project_id of the environment.
    envId String
    environment identifier.
    id String
    The provider-assigned unique ID for this managed resource.
    identifier String
    identifier for the cluster mapping(can be given any value).
    scope String
    scope at which the environment exists in harness.
    clusters List<Property Map>
    list of cluster identifiers and names
    orgId String
    org_id of the environment.
    projectId String
    project_id of the environment.

    Supporting Types

    GetEnvironmentClustersMappingCluster

    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.
    harness logo
    Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi