dynatrace.getService
The service data source allows the service ID to be retrieved by its name and optionally tags / tag-value pairs.
name
queries for all services with the specified nametags
(optional) refers to the tags that need to be present for the service (inclusive)
If multiple services match the given criteria, the first result will be retrieved.
Example Usage
using System.Collections.Generic;
using Pulumi;
using Dynatrace = Lbrlabs.PulumiPackage.Dynatrace;
using Dynatrace = Pulumi.Dynatrace;
return await Deployment.RunAsync(() =>
{
var test = Dynatrace.GetService.Invoke(new()
{
Name = "Example",
Tags = new[]
{
"TerraformKeyTest",
"TerraformKeyValueTest=TestValue",
},
});
var _name_ = new Dynatrace.KeyRequests("#name#", new()
{
Service = test.Apply(getServiceResult => getServiceResult.Id),
});
});
package main
import (
"github.com/pulumi/pulumi-dynatrace/sdk/go/dynatrace"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
test, err := dynatrace.GetService(ctx, &GetServiceArgs{
Name: "Example",
Tags: []string{
"TerraformKeyTest",
"TerraformKeyValueTest=TestValue",
},
}, nil)
if err != nil {
return err
}
_, err = dynatrace.NewKeyRequests(ctx, "#name#", &dynatrace.KeyRequestsArgs{
Service: pulumi.String(test.Id),
})
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.dynatrace.DynatraceFunctions;
import com.pulumi.dynatrace.inputs.GetServiceArgs;
import com.pulumi.dynatrace.KeyRequests;
import com.pulumi.dynatrace.KeyRequestsArgs;
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) {
final var test = DynatraceFunctions.getService(GetServiceArgs.builder()
.name("Example")
.tags(
"TerraformKeyTest",
"TerraformKeyValueTest=TestValue")
.build());
var _name_ = new KeyRequests("#name#", KeyRequestsArgs.builder()
.service(test.applyValue(getServiceResult -> getServiceResult.id()))
.build());
}
}
import pulumi
import lbrlabs_pulumi_dynatrace as dynatrace
import pulumi_dynatrace as dynatrace
test = dynatrace.get_service(name="Example",
tags=[
"TerraformKeyTest",
"TerraformKeyValueTest=TestValue",
])
_name_ = dynatrace.KeyRequests("#name#", service=test.id)
import * as pulumi from "@pulumi/pulumi";
import * as dynatrace from "@lbrlabs/pulumi-dynatrace";
import * as dynatrace from "@pulumi/dynatrace";
const test = dynatrace.getService({
name: "Example",
tags: [
"TerraformKeyTest",
"TerraformKeyValueTest=TestValue",
],
});
const _name_ = new dynatrace.KeyRequests("#name#", {service: test.then(test => test.id)});
resources:
'#name#':
type: dynatrace:KeyRequests
properties:
service: ${test.id}
variables:
test:
fn::invoke:
Function: dynatrace:getService
Arguments:
name: Example
tags:
- TerraformKeyTest
- TerraformKeyValueTest=TestValue
Using getService
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 getService(args: GetServiceArgs, opts?: InvokeOptions): Promise<GetServiceResult>
function getServiceOutput(args: GetServiceOutputArgs, opts?: InvokeOptions): Output<GetServiceResult>
def get_service(name: Optional[str] = None,
tags: Optional[Sequence[str]] = None,
opts: Optional[InvokeOptions] = None) -> GetServiceResult
def get_service_output(name: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetServiceResult]
func GetService(ctx *Context, args *GetServiceArgs, opts ...InvokeOption) (*GetServiceResult, error)
func GetServiceOutput(ctx *Context, args *GetServiceOutputArgs, opts ...InvokeOption) GetServiceResultOutput
> Note: This function is named GetService
in the Go SDK.
public static class GetService
{
public static Task<GetServiceResult> InvokeAsync(GetServiceArgs args, InvokeOptions? opts = null)
public static Output<GetServiceResult> Invoke(GetServiceInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetServiceResult> getService(GetServiceArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: dynatrace:index/getService:getService
arguments:
# arguments dictionary
The following arguments are supported:
- Name string
- List<string>
Required tags of the service to find
- Name string
- []string
Required tags of the service to find
- name String
- List<String>
Required tags of the service to find
- name string
- string[]
Required tags of the service to find
- name str
- Sequence[str]
Required tags of the service to find
- name String
- List<String>
Required tags of the service to find
getService Result
The following output properties are available:
Package Details
- Repository
- dynatrace lbrlabs/pulumi-dynatrace
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
dynatrace
Terraform Provider.