harness.Environment
Explore with Pulumi AI
Resource for creating an environment
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as harness from "@pulumi/harness";
const test = new harness.Application("test", {name: "%[1]s"});
const testKubernetes = new harness.service.Kubernetes("test", {
appId: test.id,
name: "%[1]s",
helmVersion: "V2",
description: "description",
variables: [
{
name: "test",
value: "test_value",
type: "TEXT",
},
{
name: "test2",
value: "test_value2",
type: "TEXT",
},
],
});
const testEnvironment = new harness.Environment("test", {
appId: test.id,
name: "%[1]s",
type: "%[2]s",
variableOverrides: [
{
serviceName: testKubernetes.name,
name: "test",
value: "override",
type: "TEXT",
},
{
serviceName: testKubernetes.name,
name: "test2",
value: "override2",
type: "TEXT",
},
],
});
import pulumi
import pulumi_harness as harness
test = harness.Application("test", name="%[1]s")
test_kubernetes = harness.service.Kubernetes("test",
app_id=test.id,
name="%[1]s",
helm_version="V2",
description="description",
variables=[
{
"name": "test",
"value": "test_value",
"type": "TEXT",
},
{
"name": "test2",
"value": "test_value2",
"type": "TEXT",
},
])
test_environment = harness.Environment("test",
app_id=test.id,
name="%[1]s",
type="%[2]s",
variable_overrides=[
{
"service_name": test_kubernetes.name,
"name": "test",
"value": "override",
"type": "TEXT",
},
{
"service_name": test_kubernetes.name,
"name": "test2",
"value": "override2",
"type": "TEXT",
},
])
package main
import (
"github.com/pulumi/pulumi-harness/sdk/go/harness"
"github.com/pulumi/pulumi-harness/sdk/go/harness/service"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
test, err := harness.NewApplication(ctx, "test", &harness.ApplicationArgs{
Name: pulumi.String("%[1]s"),
})
if err != nil {
return err
}
testKubernetes, err := service.NewKubernetes(ctx, "test", &service.KubernetesArgs{
AppId: test.ID(),
Name: pulumi.String("%[1]s"),
HelmVersion: pulumi.String("V2"),
Description: pulumi.String("description"),
Variables: service.KubernetesVariableArray{
&service.KubernetesVariableArgs{
Name: pulumi.String("test"),
Value: pulumi.String("test_value"),
Type: pulumi.String("TEXT"),
},
&service.KubernetesVariableArgs{
Name: pulumi.String("test2"),
Value: pulumi.String("test_value2"),
Type: pulumi.String("TEXT"),
},
},
})
if err != nil {
return err
}
_, err = harness.NewEnvironment(ctx, "test", &harness.EnvironmentArgs{
AppId: test.ID(),
Name: pulumi.String("%[1]s"),
Type: pulumi.String("%[2]s"),
VariableOverrides: harness.EnvironmentVariableOverrideArray{
&harness.EnvironmentVariableOverrideArgs{
ServiceName: testKubernetes.Name,
Name: pulumi.String("test"),
Value: pulumi.String("override"),
Type: pulumi.String("TEXT"),
},
&harness.EnvironmentVariableOverrideArgs{
ServiceName: testKubernetes.Name,
Name: pulumi.String("test2"),
Value: pulumi.String("override2"),
Type: pulumi.String("TEXT"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;
return await Deployment.RunAsync(() =>
{
var test = new Harness.Application("test", new()
{
Name = "%[1]s",
});
var testKubernetes = new Harness.Service.Kubernetes("test", new()
{
AppId = test.Id,
Name = "%[1]s",
HelmVersion = "V2",
Description = "description",
Variables = new[]
{
new Harness.Service.Inputs.KubernetesVariableArgs
{
Name = "test",
Value = "test_value",
Type = "TEXT",
},
new Harness.Service.Inputs.KubernetesVariableArgs
{
Name = "test2",
Value = "test_value2",
Type = "TEXT",
},
},
});
var testEnvironment = new Harness.Environment("test", new()
{
AppId = test.Id,
Name = "%[1]s",
Type = "%[2]s",
VariableOverrides = new[]
{
new Harness.Inputs.EnvironmentVariableOverrideArgs
{
ServiceName = testKubernetes.Name,
Name = "test",
Value = "override",
Type = "TEXT",
},
new Harness.Inputs.EnvironmentVariableOverrideArgs
{
ServiceName = testKubernetes.Name,
Name = "test2",
Value = "override2",
Type = "TEXT",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.Application;
import com.pulumi.harness.ApplicationArgs;
import com.pulumi.harness.service.Kubernetes;
import com.pulumi.harness.service.KubernetesArgs;
import com.pulumi.harness.service.inputs.KubernetesVariableArgs;
import com.pulumi.harness.Environment;
import com.pulumi.harness.EnvironmentArgs;
import com.pulumi.harness.inputs.EnvironmentVariableOverrideArgs;
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 test = new Application("test", ApplicationArgs.builder()
.name("%[1]s")
.build());
var testKubernetes = new Kubernetes("testKubernetes", KubernetesArgs.builder()
.appId(test.id())
.name("%[1]s")
.helmVersion("V2")
.description("description")
.variables(
KubernetesVariableArgs.builder()
.name("test")
.value("test_value")
.type("TEXT")
.build(),
KubernetesVariableArgs.builder()
.name("test2")
.value("test_value2")
.type("TEXT")
.build())
.build());
var testEnvironment = new Environment("testEnvironment", EnvironmentArgs.builder()
.appId(test.id())
.name("%[1]s")
.type("%[2]s")
.variableOverrides(
EnvironmentVariableOverrideArgs.builder()
.serviceName(testKubernetes.name())
.name("test")
.value("override")
.type("TEXT")
.build(),
EnvironmentVariableOverrideArgs.builder()
.serviceName(testKubernetes.name())
.name("test2")
.value("override2")
.type("TEXT")
.build())
.build());
}
}
resources:
test:
type: harness:Application
properties:
name: '%[1]s'
testKubernetes:
type: harness:service:Kubernetes
name: test
properties:
appId: ${test.id}
name: '%[1]s'
helmVersion: V2
description: description
variables:
- name: test
value: test_value
type: TEXT
- name: test2
value: test_value2
type: TEXT
testEnvironment:
type: harness:Environment
name: test
properties:
appId: ${test.id}
name: '%[1]s'
type: '%[2]s'
variableOverrides:
- serviceName: ${testKubernetes.name}
name: test
value: override
type: TEXT
- serviceName: ${testKubernetes.name}
name: test2
value: override2
type: TEXT
Create Environment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Environment(name: string, args: EnvironmentArgs, opts?: CustomResourceOptions);
@overload
def Environment(resource_name: str,
args: EnvironmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Environment(resource_name: str,
opts: Optional[ResourceOptions] = None,
app_id: Optional[str] = None,
type: Optional[str] = None,
description: Optional[str] = None,
name: Optional[str] = None,
variable_overrides: Optional[Sequence[EnvironmentVariableOverrideArgs]] = 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:Environment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var environmentResource = new Harness.Environment("environmentResource", new()
{
AppId = "string",
Type = "string",
Description = "string",
Name = "string",
VariableOverrides = new[]
{
new Harness.Inputs.EnvironmentVariableOverrideArgs
{
Name = "string",
Type = "string",
Value = "string",
ServiceName = "string",
},
},
});
example, err := harness.NewEnvironment(ctx, "environmentResource", &harness.EnvironmentArgs{
AppId: pulumi.String("string"),
Type: pulumi.String("string"),
Description: pulumi.String("string"),
Name: pulumi.String("string"),
VariableOverrides: harness.EnvironmentVariableOverrideArray{
&harness.EnvironmentVariableOverrideArgs{
Name: pulumi.String("string"),
Type: pulumi.String("string"),
Value: pulumi.String("string"),
ServiceName: pulumi.String("string"),
},
},
})
var environmentResource = new Environment("environmentResource", EnvironmentArgs.builder()
.appId("string")
.type("string")
.description("string")
.name("string")
.variableOverrides(EnvironmentVariableOverrideArgs.builder()
.name("string")
.type("string")
.value("string")
.serviceName("string")
.build())
.build());
environment_resource = harness.Environment("environmentResource",
app_id="string",
type="string",
description="string",
name="string",
variable_overrides=[{
"name": "string",
"type": "string",
"value": "string",
"service_name": "string",
}])
const environmentResource = new harness.Environment("environmentResource", {
appId: "string",
type: "string",
description: "string",
name: "string",
variableOverrides: [{
name: "string",
type: "string",
value: "string",
serviceName: "string",
}],
});
type: harness:Environment
properties:
appId: string
description: string
name: string
type: string
variableOverrides:
- name: string
serviceName: string
type: string
value: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Environment resource accepts the following input properties:
- App
Id string - The id of the application.
- Type string
- The type of the environment. Valid values are
PROD
andNON_PROD
- Description string
- The description of the environment.
- Name string
- The name of the environment.
- Variable
Overrides List<EnvironmentVariable Override> - Override for a service variable
- App
Id string - The id of the application.
- Type string
- The type of the environment. Valid values are
PROD
andNON_PROD
- Description string
- The description of the environment.
- Name string
- The name of the environment.
- Variable
Overrides []EnvironmentVariable Override Args - Override for a service variable
- app
Id String - The id of the application.
- type String
- The type of the environment. Valid values are
PROD
andNON_PROD
- description String
- The description of the environment.
- name String
- The name of the environment.
- variable
Overrides List<EnvironmentVariable Override> - Override for a service variable
- app
Id string - The id of the application.
- type string
- The type of the environment. Valid values are
PROD
andNON_PROD
- description string
- The description of the environment.
- name string
- The name of the environment.
- variable
Overrides EnvironmentVariable Override[] - Override for a service variable
- app_
id str - The id of the application.
- type str
- The type of the environment. Valid values are
PROD
andNON_PROD
- description str
- The description of the environment.
- name str
- The name of the environment.
- variable_
overrides Sequence[EnvironmentVariable Override Args] - Override for a service variable
- app
Id String - The id of the application.
- type String
- The type of the environment. Valid values are
PROD
andNON_PROD
- description String
- The description of the environment.
- name String
- The name of the environment.
- variable
Overrides List<Property Map> - Override for a service variable
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,
app_id: Optional[str] = None,
description: Optional[str] = None,
name: Optional[str] = None,
type: Optional[str] = None,
variable_overrides: Optional[Sequence[EnvironmentVariableOverrideArgs]] = 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.
- App
Id string - The id of the application.
- Description string
- The description of the environment.
- Name string
- The name of the environment.
- Type string
- The type of the environment. Valid values are
PROD
andNON_PROD
- Variable
Overrides List<EnvironmentVariable Override> - Override for a service variable
- App
Id string - The id of the application.
- Description string
- The description of the environment.
- Name string
- The name of the environment.
- Type string
- The type of the environment. Valid values are
PROD
andNON_PROD
- Variable
Overrides []EnvironmentVariable Override Args - Override for a service variable
- app
Id String - The id of the application.
- description String
- The description of the environment.
- name String
- The name of the environment.
- type String
- The type of the environment. Valid values are
PROD
andNON_PROD
- variable
Overrides List<EnvironmentVariable Override> - Override for a service variable
- app
Id string - The id of the application.
- description string
- The description of the environment.
- name string
- The name of the environment.
- type string
- The type of the environment. Valid values are
PROD
andNON_PROD
- variable
Overrides EnvironmentVariable Override[] - Override for a service variable
- app_
id str - The id of the application.
- description str
- The description of the environment.
- name str
- The name of the environment.
- type str
- The type of the environment. Valid values are
PROD
andNON_PROD
- variable_
overrides Sequence[EnvironmentVariable Override Args] - Override for a service variable
- app
Id String - The id of the application.
- description String
- The description of the environment.
- name String
- The name of the environment.
- type String
- The type of the environment. Valid values are
PROD
andNON_PROD
- variable
Overrides List<Property Map> - Override for a service variable
Supporting Types
EnvironmentVariableOverride, EnvironmentVariableOverrideArgs
- Name string
- The name of the variable
- Type string
- The type of the service variable. Valid values are
TEXT
andENCRYPTED_TEXT
- Value string
- The value of the service variable
- Service
Name string - The name of the service
- Name string
- The name of the variable
- Type string
- The type of the service variable. Valid values are
TEXT
andENCRYPTED_TEXT
- Value string
- The value of the service variable
- Service
Name string - The name of the service
- name String
- The name of the variable
- type String
- The type of the service variable. Valid values are
TEXT
andENCRYPTED_TEXT
- value String
- The value of the service variable
- service
Name String - The name of the service
- name string
- The name of the variable
- type string
- The type of the service variable. Valid values are
TEXT
andENCRYPTED_TEXT
- value string
- The value of the service variable
- service
Name string - The name of the service
- name str
- The name of the variable
- type str
- The type of the service variable. Valid values are
TEXT
andENCRYPTED_TEXT
- value str
- The value of the service variable
- service_
name str - The name of the service
- name String
- The name of the variable
- type String
- The type of the service variable. Valid values are
TEXT
andENCRYPTED_TEXT
- value String
- The value of the service variable
- service
Name String - The name of the service
Import
Import using the Harness application id and environment id.
$ pulumi import harness:index/environment:Environment dev <application_id>/<environment_id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- harness pulumi/pulumi-harness
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
harness
Terraform Provider.