azuredevops.getEnvironment
Explore with Pulumi AI
Use this data source to access information about an Environment.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const exampleProject = new azuredevops.Project("example", {
name: "Example Project",
workItemTemplate: "Agile",
versionControl: "Git",
visibility: "private",
description: "Managed by Terraform",
});
const exampleEnvironment = new azuredevops.Environment("example", {
projectId: exampleProject.id,
name: "Example Environment",
description: "Managed by Terraform",
});
const example = pulumi.all([exampleProject.id, exampleEnvironment.id]).apply(([exampleProjectId, exampleEnvironmentId]) => azuredevops.getEnvironmentOutput({
projectId: exampleProjectId,
environmentId: exampleEnvironmentId,
}));
import pulumi
import pulumi_azuredevops as azuredevops
example_project = azuredevops.Project("example",
name="Example Project",
work_item_template="Agile",
version_control="Git",
visibility="private",
description="Managed by Terraform")
example_environment = azuredevops.Environment("example",
project_id=example_project.id,
name="Example Environment",
description="Managed by Terraform")
example = pulumi.Output.all(example_project.id, example_environment.id).apply(lambda exampleProjectId, exampleEnvironmentId: azuredevops.get_environment_output(project_id=example_project_id,
environment_id=example_environment_id))
package main
import (
"github.com/pulumi/pulumi-azuredevops/sdk/v3/go/azuredevops"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleProject, err := azuredevops.NewProject(ctx, "example", &azuredevops.ProjectArgs{
Name: pulumi.String("Example Project"),
WorkItemTemplate: pulumi.String("Agile"),
VersionControl: pulumi.String("Git"),
Visibility: pulumi.String("private"),
Description: pulumi.String("Managed by Terraform"),
})
if err != nil {
return err
}
exampleEnvironment, err := azuredevops.NewEnvironment(ctx, "example", &azuredevops.EnvironmentArgs{
ProjectId: exampleProject.ID(),
Name: pulumi.String("Example Environment"),
Description: pulumi.String("Managed by Terraform"),
})
if err != nil {
return err
}
_ = pulumi.All(exampleProject.ID(), exampleEnvironment.ID()).ApplyT(func(_args []interface{}) (azuredevops.GetEnvironmentResult, error) {
exampleProjectId := _args[0].(string)
exampleEnvironmentId := _args[1].(string)
return azuredevops.LookupEnvironmentOutput(ctx, azuredevops.GetEnvironmentOutputArgs{
ProjectId: exampleProjectId,
EnvironmentId: exampleEnvironmentId,
}, nil), nil
}).(azuredevops.GetEnvironmentResultOutput)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
return await Deployment.RunAsync(() =>
{
var exampleProject = new AzureDevOps.Project("example", new()
{
Name = "Example Project",
WorkItemTemplate = "Agile",
VersionControl = "Git",
Visibility = "private",
Description = "Managed by Terraform",
});
var exampleEnvironment = new AzureDevOps.Environment("example", new()
{
ProjectId = exampleProject.Id,
Name = "Example Environment",
Description = "Managed by Terraform",
});
var example = AzureDevOps.GetEnvironment.Invoke(new()
{
ProjectId = exampleProject.Id,
EnvironmentId = exampleEnvironment.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuredevops.Project;
import com.pulumi.azuredevops.ProjectArgs;
import com.pulumi.azuredevops.Environment;
import com.pulumi.azuredevops.EnvironmentArgs;
import com.pulumi.azuredevops.AzuredevopsFunctions;
import com.pulumi.azuredevops.inputs.GetEnvironmentArgs;
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 exampleProject = new Project("exampleProject", ProjectArgs.builder()
.name("Example Project")
.workItemTemplate("Agile")
.versionControl("Git")
.visibility("private")
.description("Managed by Terraform")
.build());
var exampleEnvironment = new Environment("exampleEnvironment", EnvironmentArgs.builder()
.projectId(exampleProject.id())
.name("Example Environment")
.description("Managed by Terraform")
.build());
final var example = AzuredevopsFunctions.getEnvironment(GetEnvironmentArgs.builder()
.projectId(exampleProject.id())
.environmentId(exampleEnvironment.id())
.build());
}
}
resources:
exampleProject:
type: azuredevops:Project
name: example
properties:
name: Example Project
workItemTemplate: Agile
versionControl: Git
visibility: private
description: Managed by Terraform
exampleEnvironment:
type: azuredevops:Environment
name: example
properties:
projectId: ${exampleProject.id}
name: Example Environment
description: Managed by Terraform
variables:
example:
fn::invoke:
Function: azuredevops:getEnvironment
Arguments:
projectId: ${exampleProject.id}
environmentId: ${exampleEnvironment.id}
Relevant Links
Using getEnvironment
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 getEnvironment(args: GetEnvironmentArgs, opts?: InvokeOptions): Promise<GetEnvironmentResult>
function getEnvironmentOutput(args: GetEnvironmentOutputArgs, opts?: InvokeOptions): Output<GetEnvironmentResult>
def get_environment(environment_id: Optional[int] = None,
name: Optional[str] = None,
project_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetEnvironmentResult
def get_environment_output(environment_id: Optional[pulumi.Input[int]] = None,
name: Optional[pulumi.Input[str]] = None,
project_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetEnvironmentResult]
func LookupEnvironment(ctx *Context, args *LookupEnvironmentArgs, opts ...InvokeOption) (*LookupEnvironmentResult, error)
func LookupEnvironmentOutput(ctx *Context, args *LookupEnvironmentOutputArgs, opts ...InvokeOption) LookupEnvironmentResultOutput
> Note: This function is named LookupEnvironment
in the Go SDK.
public static class GetEnvironment
{
public static Task<GetEnvironmentResult> InvokeAsync(GetEnvironmentArgs args, InvokeOptions? opts = null)
public static Output<GetEnvironmentResult> Invoke(GetEnvironmentInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetEnvironmentResult> getEnvironment(GetEnvironmentArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: azuredevops:index/getEnvironment:getEnvironment
arguments:
# arguments dictionary
The following arguments are supported:
- Project
Id string - The ID of the project.
- Environment
Id int - The ID of the Environment.
- Name string
Name of the Environment.
NOTE: One of either
environment_id
orname
must be specified.
- Project
Id string - The ID of the project.
- Environment
Id int - The ID of the Environment.
- Name string
Name of the Environment.
NOTE: One of either
environment_id
orname
must be specified.
- project
Id String - The ID of the project.
- environment
Id Integer - The ID of the Environment.
- name String
Name of the Environment.
NOTE: One of either
environment_id
orname
must be specified.
- project
Id string - The ID of the project.
- environment
Id number - The ID of the Environment.
- name string
Name of the Environment.
NOTE: One of either
environment_id
orname
must be specified.
- project_
id str - The ID of the project.
- environment_
id int - The ID of the Environment.
- name str
Name of the Environment.
NOTE: One of either
environment_id
orname
must be specified.
- project
Id String - The ID of the project.
- environment
Id Number - The ID of the Environment.
- name String
Name of the Environment.
NOTE: One of either
environment_id
orname
must be specified.
getEnvironment Result
The following output properties are available:
- Description string
- A description for the Environment.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of the Environment.
- Project
Id string - Environment
Id int
- Description string
- A description for the Environment.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of the Environment.
- Project
Id string - Environment
Id int
- description String
- A description for the Environment.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of the Environment.
- project
Id String - environment
Id Integer
- description string
- A description for the Environment.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The name of the Environment.
- project
Id string - environment
Id number
- description str
- A description for the Environment.
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- The name of the Environment.
- project_
id str - environment_
id int
- description String
- A description for the Environment.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of the Environment.
- project
Id String - environment
Id Number
Package Details
- Repository
- Azure DevOps pulumi/pulumi-azuredevops
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azuredevops
Terraform Provider.