Harness

v0.0.5 published on Monday, Oct 31, 2022 by lbrlabs

Environment

Resource for creating a Harness environment.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Harness = Lbrlabs.PulumiPackage.Harness;

return await Deployment.RunAsync(() => 
{
    var example = new Harness.Platform.Environment("example", new()
    {
        Identifier = "identifier",
        OrgId = "org_id",
        ProjectId = "project_id",
        Tags = new[]
        {
            "foo:bar",
            "baz",
        },
        Type = "PreProduction",
        Yaml = @"			   environment:
         name: name
         identifier: identifier
         orgIdentifier: org_id
         projectIdentifier: project_id
         type: PreProduction
         tags:
           foo: bar
           baz: """"
         variables:
           - name: envVar1
             type: String
             value: v1
             description: """"
           - name: envVar2
             type: String
             value: v2
             description: """"
         overrides:
           manifests:
             - manifest:
                 identifier: manifestEnv
                 type: Values
                 spec:
                   store:
                     type: Git
                     spec:
                       connectorRef: <+input>
                       gitFetchType: Branch
                       paths:
                         - file1
                       repoName: <+input>
                       branch: master
           configFiles:
             - configFile:
                 identifier: configFileEnv
                 spec:
                   store:
                     type: Harness
                     spec:
                       files:
                         - account:/Add-ons/svcOverrideTest
                       secretFiles: []

",
    });

});
package main

import (
	"fmt"

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := platform.NewEnvironment(ctx, "example", &platform.EnvironmentArgs{
			Identifier: pulumi.String("identifier"),
			OrgId:      pulumi.String("org_id"),
			ProjectId:  pulumi.String("project_id"),
			Tags: pulumi.StringArray{
				pulumi.String("foo:bar"),
				pulumi.String("baz"),
			},
			Type: pulumi.String("PreProduction"),
			Yaml: pulumi.String(fmt.Sprintf(`			   environment:
         name: name
         identifier: identifier
         orgIdentifier: org_id
         projectIdentifier: project_id
         type: PreProduction
         tags:
           foo: bar
           baz: ""
         variables:
           - name: envVar1
             type: String
             value: v1
             description: ""
           - name: envVar2
             type: String
             value: v2
             description: ""
         overrides:
           manifests:
             - manifest:
                 identifier: manifestEnv
                 type: Values
                 spec:
                   store:
                     type: Git
                     spec:
                       connectorRef: <+input>
                       gitFetchType: Branch
                       paths:
                         - file1
                       repoName: <+input>
                       branch: master
           configFiles:
             - configFile:
                 identifier: configFileEnv
                 spec:
                   store:
                     type: Harness
                     spec:
                       files:
                         - account:/Add-ons/svcOverrideTest
                       secretFiles: []

`)),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.platform.Environment;
import com.pulumi.harness.platform.EnvironmentArgs;
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 example = new Environment("example", EnvironmentArgs.builder()        
            .identifier("identifier")
            .orgId("org_id")
            .projectId("project_id")
            .tags(            
                "foo:bar",
                "baz")
            .type("PreProduction")
            .yaml("""
			   environment:
         name: name
         identifier: identifier
         orgIdentifier: org_id
         projectIdentifier: project_id
         type: PreProduction
         tags:
           foo: bar
           baz: ""
         variables:
           - name: envVar1
             type: String
             value: v1
             description: ""
           - name: envVar2
             type: String
             value: v2
             description: ""
         overrides:
           manifests:
             - manifest:
                 identifier: manifestEnv
                 type: Values
                 spec:
                   store:
                     type: Git
                     spec:
                       connectorRef: <+input>
                       gitFetchType: Branch
                       paths:
                         - file1
                       repoName: <+input>
                       branch: master
           configFiles:
             - configFile:
                 identifier: configFileEnv
                 spec:
                   store:
                     type: Harness
                     spec:
                       files:
                         - account:/Add-ons/svcOverrideTest
                       secretFiles: []

            """)
            .build());

    }
}
import pulumi
import lbrlabs_pulumi_harness as harness

example = harness.platform.Environment("example",
    identifier="identifier",
    org_id="org_id",
    project_id="project_id",
    tags=[
        "foo:bar",
        "baz",
    ],
    type="PreProduction",
    yaml="""			   environment:
         name: name
         identifier: identifier
         orgIdentifier: org_id
         projectIdentifier: project_id
         type: PreProduction
         tags:
           foo: bar
           baz: ""
         variables:
           - name: envVar1
             type: String
             value: v1
             description: ""
           - name: envVar2
             type: String
             value: v2
             description: ""
         overrides:
           manifests:
             - manifest:
                 identifier: manifestEnv
                 type: Values
                 spec:
                   store:
                     type: Git
                     spec:
                       connectorRef: <+input>
                       gitFetchType: Branch
                       paths:
                         - file1
                       repoName: <+input>
                       branch: master
           configFiles:
             - configFile:
                 identifier: configFileEnv
                 spec:
                   store:
                     type: Harness
                     spec:
                       files:
                         - account:/Add-ons/svcOverrideTest
                       secretFiles: []

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

const example = new harness.platform.Environment("example", {
    identifier: "identifier",
    orgId: "org_id",
    projectId: "project_id",
    tags: [
        "foo:bar",
        "baz",
    ],
    type: "PreProduction",
    yaml: `			   environment:
         name: name
         identifier: identifier
         orgIdentifier: org_id
         projectIdentifier: project_id
         type: PreProduction
         tags:
           foo: bar
           baz: ""
         variables:
           - name: envVar1
             type: String
             value: v1
             description: ""
           - name: envVar2
             type: String
             value: v2
             description: ""
         overrides:
           manifests:
             - manifest:
                 identifier: manifestEnv
                 type: Values
                 spec:
                   store:
                     type: Git
                     spec:
                       connectorRef: <+input>
                       gitFetchType: Branch
                       paths:
                         - file1
                       repoName: <+input>
                       branch: master
           configFiles:
             - configFile:
                 identifier: configFileEnv
                 spec:
                   store:
                     type: Harness
                     spec:
                       files:
                         - account:/Add-ons/svcOverrideTest
                       secretFiles: []
`,
});
resources:
  example:
    type: harness:platform:Environment
    properties:
      identifier: identifier
      orgId: org_id
      projectId: project_id
      tags:
        - foo:bar
        - baz
      type: PreProduction
      yaml: |+
        			   environment:
                 name: name
                 identifier: identifier
                 orgIdentifier: org_id
                 projectIdentifier: project_id
                 type: PreProduction
                 tags:
                   foo: bar
                   baz: ""
                 variables:
                   - name: envVar1
                     type: String
                     value: v1
                     description: ""
                   - name: envVar2
                     type: String
                     value: v2
                     description: ""
                 overrides:
                   manifests:
                     - manifest:
                         identifier: manifestEnv
                         type: Values
                         spec:
                           store:
                             type: Git
                             spec:
                               connectorRef: <+input>
                               gitFetchType: Branch
                               paths:
                                 - file1
                               repoName: <+input>
                               branch: master
                   configFiles:
                     - configFile:
                         identifier: configFileEnv
                         spec:
                           store:
                             type: Harness
                             spec:
                               files:
                                 - account:/Add-ons/svcOverrideTest
                               secretFiles: []        

Create Environment Resource

new Environment(name: string, args: EnvironmentArgs, opts?: CustomResourceOptions);
@overload
def Environment(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                color: Optional[str] = None,
                description: Optional[str] = None,
                identifier: Optional[str] = None,
                name: Optional[str] = None,
                org_id: Optional[str] = None,
                project_id: Optional[str] = None,
                tags: Optional[Sequence[str]] = None,
                type: Optional[str] = None,
                yaml: Optional[str] = None)
@overload
def Environment(resource_name: str,
                args: EnvironmentArgs,
                opts: Optional[ResourceOptions] = None)
func NewEnvironment(ctx *Context, name string, args EnvironmentArgs, opts ...ResourceOption) (*Environment, error)
public Environment(string name, EnvironmentArgs args, CustomResourceOptions? opts = null)
public Environment(String name, EnvironmentArgs args)
public Environment(String name, EnvironmentArgs args, CustomResourceOptions options)
type: harness:platform:Environment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

Environment Resource Properties

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

Inputs

The Environment resource accepts the following input properties:

Identifier string

Unique identifier of the resource.

OrgId string

Unique identifier of the organization.

ProjectId string

Unique identifier of the project.

Type string

The type of environment. Valid values are PreProduction, Production

Color string

Color of the environment.

Description string

Description of the resource.

Name string

Name of the resource.

Tags List<string>

Tags to associate with the resource. Tags should be in the form name:value.

Yaml string

Environment YAML

Identifier string

Unique identifier of the resource.

OrgId string

Unique identifier of the organization.

ProjectId string

Unique identifier of the project.

Type string

The type of environment. Valid values are PreProduction, Production

Color string

Color of the environment.

Description string

Description of the resource.

Name string

Name of the resource.

Tags []string

Tags to associate with the resource. Tags should be in the form name:value.

Yaml string

Environment YAML

identifier String

Unique identifier of the resource.

orgId String

Unique identifier of the organization.

projectId String

Unique identifier of the project.

type String

The type of environment. Valid values are PreProduction, Production

color String

Color of the environment.

description String

Description of the resource.

name String

Name of the resource.

tags List<String>

Tags to associate with the resource. Tags should be in the form name:value.

yaml String

Environment YAML

identifier string

Unique identifier of the resource.

orgId string

Unique identifier of the organization.

projectId string

Unique identifier of the project.

type string

The type of environment. Valid values are PreProduction, Production

color string

Color of the environment.

description string

Description of the resource.

name string

Name of the resource.

tags string[]

Tags to associate with the resource. Tags should be in the form name:value.

yaml string

Environment YAML

identifier str

Unique identifier of the resource.

org_id str

Unique identifier of the organization.

project_id str

Unique identifier of the project.

type str

The type of environment. Valid values are PreProduction, Production

color str

Color of the environment.

description str

Description of the resource.

name str

Name of the resource.

tags Sequence[str]

Tags to associate with the resource. Tags should be in the form name:value.

yaml str

Environment YAML

identifier String

Unique identifier of the resource.

orgId String

Unique identifier of the organization.

projectId String

Unique identifier of the project.

type String

The type of environment. Valid values are PreProduction, Production

color String

Color of the environment.

description String

Description of the resource.

name String

Name of the resource.

tags List<String>

Tags to associate with the resource. Tags should be in the form name:value.

yaml String

Environment YAML

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing Environment Resource

Get an existing Environment 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?: EnvironmentState, opts?: CustomResourceOptions): Environment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        color: Optional[str] = None,
        description: Optional[str] = None,
        identifier: Optional[str] = None,
        name: Optional[str] = None,
        org_id: Optional[str] = None,
        project_id: Optional[str] = None,
        tags: Optional[Sequence[str]] = None,
        type: Optional[str] = None,
        yaml: Optional[str] = None) -> Environment
func GetEnvironment(ctx *Context, name string, id IDInput, state *EnvironmentState, opts ...ResourceOption) (*Environment, error)
public static Environment Get(string name, Input<string> id, EnvironmentState? state, CustomResourceOptions? opts = null)
public static Environment get(String name, Output<String> id, EnvironmentState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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:
Color string

Color of the environment.

Description string

Description of the resource.

Identifier string

Unique identifier of the resource.

Name string

Name of the resource.

OrgId string

Unique identifier of the organization.

ProjectId string

Unique identifier of the project.

Tags List<string>

Tags to associate with the resource. Tags should be in the form name:value.

Type string

The type of environment. Valid values are PreProduction, Production

Yaml string

Environment YAML

Color string

Color of the environment.

Description string

Description of the resource.

Identifier string

Unique identifier of the resource.

Name string

Name of the resource.

OrgId string

Unique identifier of the organization.

ProjectId string

Unique identifier of the project.

Tags []string

Tags to associate with the resource. Tags should be in the form name:value.

Type string

The type of environment. Valid values are PreProduction, Production

Yaml string

Environment YAML

color String

Color of the environment.

description String

Description of the resource.

identifier String

Unique identifier of the resource.

name String

Name of the resource.

orgId String

Unique identifier of the organization.

projectId String

Unique identifier of the project.

tags List<String>

Tags to associate with the resource. Tags should be in the form name:value.

type String

The type of environment. Valid values are PreProduction, Production

yaml String

Environment YAML

color string

Color of the environment.

description string

Description of the resource.

identifier string

Unique identifier of the resource.

name string

Name of the resource.

orgId string

Unique identifier of the organization.

projectId string

Unique identifier of the project.

tags string[]

Tags to associate with the resource. Tags should be in the form name:value.

type string

The type of environment. Valid values are PreProduction, Production

yaml string

Environment YAML

color str

Color of the environment.

description str

Description of the resource.

identifier str

Unique identifier of the resource.

name str

Name of the resource.

org_id str

Unique identifier of the organization.

project_id str

Unique identifier of the project.

tags Sequence[str]

Tags to associate with the resource. Tags should be in the form name:value.

type str

The type of environment. Valid values are PreProduction, Production

yaml str

Environment YAML

color String

Color of the environment.

description String

Description of the resource.

identifier String

Unique identifier of the resource.

name String

Name of the resource.

orgId String

Unique identifier of the organization.

projectId String

Unique identifier of the project.

tags List<String>

Tags to associate with the resource. Tags should be in the form name:value.

type String

The type of environment. Valid values are PreProduction, Production

yaml String

Environment YAML

Import

Import using environment id

 $ pulumi import harness:platform/environment:Environment example <environment_id>

Package Details

Repository
https://github.com/lbrlabs/pulumi-harness
License
Apache-2.0
Notes

This Pulumi package is based on the harness Terraform Provider.