getService function
The ECS Service data source allows access to details of a specific Service within a AWS ECS Cluster.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.ecs.getService({
serviceName: "example",
clusterArn: exampleAwsEcsCluster.arn,
});
import pulumi
import pulumi_aws as aws
example = aws.ecs.get_service(service_name="example",
cluster_arn=example_aws_ecs_cluster["arn"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.Ecs.GetService.Invoke(new()
{
ServiceName = "example",
ClusterArn = exampleAwsEcsCluster.Arn,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ecs"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ecs.LookupService(ctx, &ecs.LookupServiceArgs{
ServiceName: "example",
ClusterArn: exampleAwsEcsCluster.Arn,
}, nil)
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_ecs_getservice" "example" {
service_name = "example"
cluster_arn = exampleAwsEcsCluster.arn
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ecs.EcsFunctions;
import com.pulumi.aws.ecs.inputs.GetServiceArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 example = EcsFunctions.getService(GetServiceArgs.builder()
.serviceName("example")
.clusterArn(exampleAwsEcsCluster.arn())
.build());
}
}
variables:
example:
fn::invoke:
function: aws:ecs:getService
arguments:
serviceName: example
clusterArn: ${exampleAwsEcsCluster.arn}
args Arguments passed to this invoke. Arguments for getService.
options Invoke options controlling this call.
Implementation
Future<GetServiceResult> getService(
GetServiceArgs args, {
pulumi.InvokeOptions? options,
}) async {
final deployment = pulumi.Deployment.instance;
final result = await deployment.invoke<Map<String, dynamic>>(
'aws:ecs/getService:getService',
args.toMap(),
options: pulumi.toDeploymentInvokeOptions(options),
);
return GetServiceResult.fromMap(result);
}