ContainerAssociation class

Manages an AWS Network Firewall Container Association. A container association links Amazon ECS or Amazon EKS clusters to Network Firewall, resolving container IP addresses into a dynamic IP set you can reference from stateful rule groups.

Example Usage

EKS Cluster

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

const example = new aws.networkfirewall.ContainerAssociation("example", {
    containerAssociationName: "example-eks-association",
    type: "EKS",
    description: "Association for production EKS cluster",
    containerMonitoringConfigurations: [{
        clusterArn: exampleAwsEksCluster.arn,
        attributeFilters: [{
            key: "app",
            value: "backend",
        }],
    }],
    tags: {
        Name: "example",
        Environment: "production",
    },
});
import pulumi
import pulumi_aws as aws

example = aws.networkfirewall.ContainerAssociation("example",
    container_association_name="example-eks-association",
    type="EKS",
    description="Association for production EKS cluster",
    container_monitoring_configurations=[{
        "cluster_arn": example_aws_eks_cluster["arn"],
        "attribute_filters": [{
            "key": "app",
            "value": "backend",
        }],
    }],
    tags={
        "Name": "example",
        "Environment": "production",
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.NetworkFirewall.ContainerAssociation("example", new()
    {
        ContainerAssociationName = "example-eks-association",
        Type = "EKS",
        Description = "Association for production EKS cluster",
        ContainerMonitoringConfigurations = new[]
        {
            new Aws.NetworkFirewall.Inputs.ContainerAssociationContainerMonitoringConfigurationArgs
            {
                ClusterArn = exampleAwsEksCluster.Arn,
                AttributeFilters = new[]
                {
                    new Aws.NetworkFirewall.Inputs.ContainerAssociationContainerMonitoringConfigurationAttributeFilterArgs
                    {
                        Key = "app",
                        Value = "backend",
                    },
                },
            },
        },
        Tags =
        {
            { "Name", "example" },
            { "Environment", "production" },
        },
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := networkfirewall.NewContainerAssociation(ctx, "example", &networkfirewall.ContainerAssociationArgs{
			ContainerAssociationName: pulumi.String("example-eks-association"),
			Type:                     pulumi.String("EKS"),
			Description:              pulumi.String("Association for production EKS cluster"),
			ContainerMonitoringConfigurations: networkfirewall.ContainerAssociationContainerMonitoringConfigurationArray{
				&networkfirewall.ContainerAssociationContainerMonitoringConfigurationArgs{
					ClusterArn: pulumi.Any(exampleAwsEksCluster.Arn),
					AttributeFilters: networkfirewall.ContainerAssociationContainerMonitoringConfigurationAttributeFilterArray{
						&networkfirewall.ContainerAssociationContainerMonitoringConfigurationAttributeFilterArgs{
							Key:   pulumi.String("app"),
							Value: pulumi.String("backend"),
						},
					},
				},
			},
			Tags: pulumi.StringMap{
				"Name":        pulumi.String("example"),
				"Environment": pulumi.String("production"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_networkfirewall_containerassociation" "example" {
  container_association_name = "example-eks-association"
  type                       = "EKS"
  description                = "Association for production EKS cluster"
  container_monitoring_configurations {
    cluster_arn = exampleAwsEksCluster.arn
    attribute_filters {
      key   = "app"
      value = "backend"
    }
  }
  tags = {
    "Name"        = "example"
    "Environment" = "production"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.networkfirewall.ContainerAssociation;
import com.pulumi.aws.networkfirewall.ContainerAssociationArgs;
import com.pulumi.aws.networkfirewall.inputs.ContainerAssociationContainerMonitoringConfigurationArgs;
import com.pulumi.aws.networkfirewall.inputs.ContainerAssociationContainerMonitoringConfigurationAttributeFilterArgs;
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 ContainerAssociation("example", ContainerAssociationArgs.builder()
            .containerAssociationName("example-eks-association")
            .type("EKS")
            .description("Association for production EKS cluster")
            .containerMonitoringConfigurations(ContainerAssociationContainerMonitoringConfigurationArgs.builder()
                .clusterArn(exampleAwsEksCluster.arn())
                .attributeFilters(ContainerAssociationContainerMonitoringConfigurationAttributeFilterArgs.builder()
                    .key("app")
                    .value("backend")
                    .build())
                .build())
            .tags(Map.ofEntries(
                Map.entry("Name", "example"),
                Map.entry("Environment", "production")
            ))
            .build());

    }
}
resources:
  example:
    type: aws:networkfirewall:ContainerAssociation
    properties:
      containerAssociationName: example-eks-association
      type: EKS
      description: Association for production EKS cluster
      containerMonitoringConfigurations:
        - clusterArn: ${exampleAwsEksCluster.arn}
          attributeFilters:
            - key: app
              value: backend
      tags:
        Name: example
        Environment: production

ECS Cluster

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

const example = new aws.networkfirewall.ContainerAssociation("example", {
    containerAssociationName: "example-ecs-association",
    type: "ECS",
    containerMonitoringConfigurations: [{
        clusterArn: exampleAwsEcsCluster.arn,
    }],
});
import pulumi
import pulumi_aws as aws

example = aws.networkfirewall.ContainerAssociation("example",
    container_association_name="example-ecs-association",
    type="ECS",
    container_monitoring_configurations=[{
        "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 = new Aws.NetworkFirewall.ContainerAssociation("example", new()
    {
        ContainerAssociationName = "example-ecs-association",
        Type = "ECS",
        ContainerMonitoringConfigurations = new[]
        {
            new Aws.NetworkFirewall.Inputs.ContainerAssociationContainerMonitoringConfigurationArgs
            {
                ClusterArn = exampleAwsEcsCluster.Arn,
            },
        },
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := networkfirewall.NewContainerAssociation(ctx, "example", &networkfirewall.ContainerAssociationArgs{
			ContainerAssociationName: pulumi.String("example-ecs-association"),
			Type:                     pulumi.String("ECS"),
			ContainerMonitoringConfigurations: networkfirewall.ContainerAssociationContainerMonitoringConfigurationArray{
				&networkfirewall.ContainerAssociationContainerMonitoringConfigurationArgs{
					ClusterArn: pulumi.Any(exampleAwsEcsCluster.Arn),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_networkfirewall_containerassociation" "example" {
  container_association_name = "example-ecs-association"
  type                       = "ECS"
  container_monitoring_configurations {
    cluster_arn = exampleAwsEcsCluster.arn
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.networkfirewall.ContainerAssociation;
import com.pulumi.aws.networkfirewall.ContainerAssociationArgs;
import com.pulumi.aws.networkfirewall.inputs.ContainerAssociationContainerMonitoringConfigurationArgs;
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 ContainerAssociation("example", ContainerAssociationArgs.builder()
            .containerAssociationName("example-ecs-association")
            .type("ECS")
            .containerMonitoringConfigurations(ContainerAssociationContainerMonitoringConfigurationArgs.builder()
                .clusterArn(exampleAwsEcsCluster.arn())
                .build())
            .build());

    }
}
resources:
  example:
    type: aws:networkfirewall:ContainerAssociation
    properties:
      containerAssociationName: example-ecs-association
      type: ECS
      containerMonitoringConfigurations:
        - clusterArn: ${exampleAwsEcsCluster.arn}

Import

Identity Schema

Required

  • containerAssociationArn (String) ARN of the container association.

Using pulumi import, import Network Firewall Container Association using the containerAssociationArn. For example:

$ pulumi import aws:networkfirewall/containerAssociation:ContainerAssociation example arn:aws:network-firewall:us-west-2:123456789012:container-association/example

Constructors

ContainerAssociation(String name, {ContainerAssociationArgs? args, CustomResourceOptions? options})
Creates a new ContainerAssociation. name The Pulumi resource name. args Arguments used to configure this ContainerAssociation. The set of arguments for ContainerAssociation. options Resource options controlling this resource's behavior.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
containerAssociationArn ↔ Output<String>
ARN of the container association.
latefinal
containerAssociationName ↔ Output<String>
Name of the container association. You can't change the name after creation. Must be between 1 and 128 characters and contain only alphanumeric characters and hyphens.
latefinal
containerMonitoringConfigurations ↔ Output<List<Map<String, dynamic>>>
One or more monitoring configurations, up to 5. See containerMonitoringConfiguration Block below.
latefinal
description ↔ Output<String?>
Description of the container association.
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
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resolvedCidrCount ↔ Output<int>
Number of CIDR blocks resolved from the monitored containers for this container association.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tags ↔ Output<Map<String, String>?>
Map of resource tags to associate with the resource. 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
timeouts ↔ Output<ContainerAssociationTimeouts?>
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
type ↔ Output<String>
Container orchestration platform for the clusters in this association. Valid values: ECS, EKS. You can't change the type after creation.
latefinal
updateToken ↔ Output<String>
Token used for optimistic locking.
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, {ContainerAssociationState? state}) → ContainerAssociation
Gets an existing ContainerAssociation resource's state with the given name and id.