TargetGroup class

Resource for managing an AWS VPC Lattice Target Group.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.vpclattice.TargetGroup("example", {
    config: {
        vpcIdentifier: exampleAwsVpc.id,
        port: 443,
        protocol: "HTTPS",
    },
    name: "example",
    type: "INSTANCE",
});
import pulumi
import pulumi_aws as aws

example = aws.vpclattice.TargetGroup("example",
    config={
        "vpc_identifier": example_aws_vpc["id"],
        "port": 443,
        "protocol": "HTTPS",
    },
    name="example",
    type="INSTANCE")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.VpcLattice.TargetGroup("example", new()
    {
        Config = new Aws.VpcLattice.Inputs.TargetGroupConfigArgs
        {
            VpcIdentifier = exampleAwsVpc.Id,
            Port = 443,
            Protocol = "HTTPS",
        },
        Name = "example",
        Type = "INSTANCE",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/vpclattice"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := vpclattice.NewTargetGroup(ctx, "example", &vpclattice.TargetGroupArgs{
			Config: &vpclattice.TargetGroupConfigArgs{
				VpcIdentifier: pulumi.Any(exampleAwsVpc.Id),
				Port:          pulumi.Int(443),
				Protocol:      pulumi.String("HTTPS"),
			},
			Name: pulumi.String("example"),
			Type: pulumi.String("INSTANCE"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_vpclattice_targetgroup" "example" {
  config = {
    vpc_identifier = exampleAwsVpc.id
    port           = 443
    protocol       = "HTTPS"
  }
  name = "example"
  type = "INSTANCE"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.vpclattice.TargetGroup;
import com.pulumi.aws.vpclattice.TargetGroupArgs;
import com.pulumi.aws.vpclattice.inputs.TargetGroupConfigArgs;
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) {
        var example = new TargetGroup("example", TargetGroupArgs.builder()
            .config(TargetGroupConfigArgs.builder()
                .vpcIdentifier(exampleAwsVpc.id())
                .port(443)
                .protocol("HTTPS")
                .build())
            .name("example")
            .type("INSTANCE")
            .build());

    }
}
resources:
  example:
    type: aws:vpclattice:TargetGroup
    properties:
      config:
        vpcIdentifier: ${exampleAwsVpc.id}
        port: 443
        protocol: HTTPS
      name: example
      type: INSTANCE

Basic usage with Health check

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.vpclattice.TargetGroup("example", {
    config: {
        healthCheck: {
            matcher: {
                value: "200-299",
            },
            enabled: true,
            healthCheckIntervalSeconds: 20,
            healthCheckTimeoutSeconds: 10,
            healthyThresholdCount: 7,
            unhealthyThresholdCount: 3,
            path: "/instance",
            port: 80,
            protocol: "HTTP",
            protocolVersion: "HTTP1",
        },
        vpcIdentifier: exampleAwsVpc.id,
        ipAddressType: "IPV4",
        port: 443,
        protocol: "HTTPS",
        protocolVersion: "HTTP1",
    },
    name: "example",
    type: "IP",
});
import pulumi
import pulumi_aws as aws

example = aws.vpclattice.TargetGroup("example",
    config={
        "health_check": {
            "matcher": {
                "value": "200-299",
            },
            "enabled": True,
            "health_check_interval_seconds": 20,
            "health_check_timeout_seconds": 10,
            "healthy_threshold_count": 7,
            "unhealthy_threshold_count": 3,
            "path": "/instance",
            "port": 80,
            "protocol": "HTTP",
            "protocol_version": "HTTP1",
        },
        "vpc_identifier": example_aws_vpc["id"],
        "ip_address_type": "IPV4",
        "port": 443,
        "protocol": "HTTPS",
        "protocol_version": "HTTP1",
    },
    name="example",
    type="IP")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.VpcLattice.TargetGroup("example", new()
    {
        Config = new Aws.VpcLattice.Inputs.TargetGroupConfigArgs
        {
            HealthCheck = new Aws.VpcLattice.Inputs.TargetGroupConfigHealthCheckArgs
            {
                Matcher = new Aws.VpcLattice.Inputs.TargetGroupConfigHealthCheckMatcherArgs
                {
                    Value = "200-299",
                },
                Enabled = true,
                HealthCheckIntervalSeconds = 20,
                HealthCheckTimeoutSeconds = 10,
                HealthyThresholdCount = 7,
                UnhealthyThresholdCount = 3,
                Path = "/instance",
                Port = 80,
                Protocol = "HTTP",
                ProtocolVersion = "HTTP1",
            },
            VpcIdentifier = exampleAwsVpc.Id,
            IpAddressType = "IPV4",
            Port = 443,
            Protocol = "HTTPS",
            ProtocolVersion = "HTTP1",
        },
        Name = "example",
        Type = "IP",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/vpclattice"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := vpclattice.NewTargetGroup(ctx, "example", &vpclattice.TargetGroupArgs{
			Config: &vpclattice.TargetGroupConfigArgs{
				HealthCheck: &vpclattice.TargetGroupConfigHealthCheckArgs{
					Matcher: &vpclattice.TargetGroupConfigHealthCheckMatcherArgs{
						Value: pulumi.String("200-299"),
					},
					Enabled:                    pulumi.Bool(true),
					HealthCheckIntervalSeconds: pulumi.Int(20),
					HealthCheckTimeoutSeconds:  pulumi.Int(10),
					HealthyThresholdCount:      pulumi.Int(7),
					UnhealthyThresholdCount:    pulumi.Int(3),
					Path:                       pulumi.String("/instance"),
					Port:                       pulumi.Int(80),
					Protocol:                   pulumi.String("HTTP"),
					ProtocolVersion:            pulumi.String("HTTP1"),
				},
				VpcIdentifier:   pulumi.Any(exampleAwsVpc.Id),
				IpAddressType:   pulumi.String("IPV4"),
				Port:            pulumi.Int(443),
				Protocol:        pulumi.String("HTTPS"),
				ProtocolVersion: pulumi.String("HTTP1"),
			},
			Name: pulumi.String("example"),
			Type: pulumi.String("IP"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_vpclattice_targetgroup" "example" {
  config = {
    health_check = {
      matcher = {
        value = "200-299"
      }
      enabled                       = true
      health_check_interval_seconds = 20
      health_check_timeout_seconds  = 10
      healthy_threshold_count       = 7
      unhealthy_threshold_count     = 3
      path                          = "/instance"
      port                          = 80
      protocol                      = "HTTP"
      protocol_version              = "HTTP1"
    }
    vpc_identifier   = exampleAwsVpc.id
    ip_address_type  = "IPV4"
    port             = 443
    protocol         = "HTTPS"
    protocol_version = "HTTP1"
  }
  name = "example"
  type = "IP"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.vpclattice.TargetGroup;
import com.pulumi.aws.vpclattice.TargetGroupArgs;
import com.pulumi.aws.vpclattice.inputs.TargetGroupConfigArgs;
import com.pulumi.aws.vpclattice.inputs.TargetGroupConfigHealthCheckArgs;
import com.pulumi.aws.vpclattice.inputs.TargetGroupConfigHealthCheckMatcherArgs;
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) {
        var example = new TargetGroup("example", TargetGroupArgs.builder()
            .config(TargetGroupConfigArgs.builder()
                .healthCheck(TargetGroupConfigHealthCheckArgs.builder()
                    .matcher(TargetGroupConfigHealthCheckMatcherArgs.builder()
                        .value("200-299")
                        .build())
                    .enabled(true)
                    .healthCheckIntervalSeconds(20)
                    .healthCheckTimeoutSeconds(10)
                    .healthyThresholdCount(7)
                    .unhealthyThresholdCount(3)
                    .path("/instance")
                    .port(80)
                    .protocol("HTTP")
                    .protocolVersion("HTTP1")
                    .build())
                .vpcIdentifier(exampleAwsVpc.id())
                .ipAddressType("IPV4")
                .port(443)
                .protocol("HTTPS")
                .protocolVersion("HTTP1")
                .build())
            .name("example")
            .type("IP")
            .build());

    }
}
resources:
  example:
    type: aws:vpclattice:TargetGroup
    properties:
      config:
        healthCheck:
          matcher:
            value: 200-299
          enabled: true
          healthCheckIntervalSeconds: 20
          healthCheckTimeoutSeconds: 10
          healthyThresholdCount: 7
          unhealthyThresholdCount: 3
          path: /instance
          port: 80
          protocol: HTTP
          protocolVersion: HTTP1
        vpcIdentifier: ${exampleAwsVpc.id}
        ipAddressType: IPV4
        port: 443
        protocol: HTTPS
        protocolVersion: HTTP1
      name: example
      type: IP

ALB

If the type is ALB, healthCheck block is not supported.

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.vpclattice.TargetGroup("example", {
    config: {
        vpcIdentifier: exampleAwsVpc.id,
        port: 443,
        protocol: "HTTPS",
        protocolVersion: "HTTP1",
    },
    name: "example",
    type: "ALB",
});
import pulumi
import pulumi_aws as aws

example = aws.vpclattice.TargetGroup("example",
    config={
        "vpc_identifier": example_aws_vpc["id"],
        "port": 443,
        "protocol": "HTTPS",
        "protocol_version": "HTTP1",
    },
    name="example",
    type="ALB")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.VpcLattice.TargetGroup("example", new()
    {
        Config = new Aws.VpcLattice.Inputs.TargetGroupConfigArgs
        {
            VpcIdentifier = exampleAwsVpc.Id,
            Port = 443,
            Protocol = "HTTPS",
            ProtocolVersion = "HTTP1",
        },
        Name = "example",
        Type = "ALB",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/vpclattice"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := vpclattice.NewTargetGroup(ctx, "example", &vpclattice.TargetGroupArgs{
			Config: &vpclattice.TargetGroupConfigArgs{
				VpcIdentifier:   pulumi.Any(exampleAwsVpc.Id),
				Port:            pulumi.Int(443),
				Protocol:        pulumi.String("HTTPS"),
				ProtocolVersion: pulumi.String("HTTP1"),
			},
			Name: pulumi.String("example"),
			Type: pulumi.String("ALB"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_vpclattice_targetgroup" "example" {
  config = {
    vpc_identifier   = exampleAwsVpc.id
    port             = 443
    protocol         = "HTTPS"
    protocol_version = "HTTP1"
  }
  name = "example"
  type = "ALB"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.vpclattice.TargetGroup;
import com.pulumi.aws.vpclattice.TargetGroupArgs;
import com.pulumi.aws.vpclattice.inputs.TargetGroupConfigArgs;
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) {
        var example = new TargetGroup("example", TargetGroupArgs.builder()
            .config(TargetGroupConfigArgs.builder()
                .vpcIdentifier(exampleAwsVpc.id())
                .port(443)
                .protocol("HTTPS")
                .protocolVersion("HTTP1")
                .build())
            .name("example")
            .type("ALB")
            .build());

    }
}
resources:
  example:
    type: aws:vpclattice:TargetGroup
    properties:
      config:
        vpcIdentifier: ${exampleAwsVpc.id}
        port: 443
        protocol: HTTPS
        protocolVersion: HTTP1
      name: example
      type: ALB

Lambda

If the type is Lambda, config block is not supported.

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.vpclattice.TargetGroup("example", {
    name: "example",
    type: "LAMBDA",
});
import pulumi
import pulumi_aws as aws

example = aws.vpclattice.TargetGroup("example",
    name="example",
    type="LAMBDA")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.VpcLattice.TargetGroup("example", new()
    {
        Name = "example",
        Type = "LAMBDA",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/vpclattice"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := vpclattice.NewTargetGroup(ctx, "example", &vpclattice.TargetGroupArgs{
			Name: pulumi.String("example"),
			Type: pulumi.String("LAMBDA"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_vpclattice_targetgroup" "example" {
  name = "example"
  type = "LAMBDA"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.vpclattice.TargetGroup;
import com.pulumi.aws.vpclattice.TargetGroupArgs;
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) {
        var example = new TargetGroup("example", TargetGroupArgs.builder()
            .name("example")
            .type("LAMBDA")
            .build());

    }
}
resources:
  example:
    type: aws:vpclattice:TargetGroup
    properties:
      name: example
      type: LAMBDA

Import

Using pulumi import, import VPC Lattice Target Group using the id. For example:

$ pulumi import aws:vpclattice/targetGroup:TargetGroup example tg-0c11d4dc16ed96bdb

Constructors

TargetGroup(String name, {TargetGroupArgs? args, CustomResourceOptions? options})
Creates a new TargetGroup. name The Pulumi resource name. args Arguments used to configure this TargetGroup. The set of arguments for TargetGroup. options Resource options controlling this resource's behavior.
TargetGroup.reference(String urn)
Creates a typed reference to an existing TargetGroup resource.

Properties

arn ↔ Output<String>
ARN of the target group.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
config ↔ Output<TargetGroupConfig?>
Target group configuration. See config Block below.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
name ↔ Output<String>
Name of the target group. The name must be unique within the account. The valid characters are a-z, 0-9, and hyphens (-). You can't use a hyphen as the first or last character, or immediately after another hyphen.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
status ↔ Output<String>
Status of the target group.
latefinal
tags ↔ Output<Map<String, String>?>
Key-value mapping of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
type ↔ Output<String>
Type of target group. Valid values are IP, LAMBDA, INSTANCE, or ALB.
latefinal
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {TargetGroupState? state, CustomResourceOptions? options}) → TargetGroup
Gets an existing TargetGroup resource's state with the given name and id.