MeteringPolicyEntry class

Manages an EC2 Transit Gateway Metering Policy Entry. Each entry defines a traffic matching rule within a Transit Gateway Metering Policy that determines which account is charged for matching traffic flows.

Example Usage

Basic Usage

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

const example = new aws.ec2transitgateway.MeteringPolicyEntry("example", {
    transitGatewayMeteringPolicyId: exampleAwsEc2TransitGatewayMeteringPolicy.transitGatewayMeteringPolicyId,
    policyRuleNumber: 100,
    meteredAccount: "source-attachment-owner",
});
import pulumi
import pulumi_aws as aws

example = aws.ec2transitgateway.MeteringPolicyEntry("example",
    transit_gateway_metering_policy_id=example_aws_ec2_transit_gateway_metering_policy["transitGatewayMeteringPolicyId"],
    policy_rule_number=100,
    metered_account="source-attachment-owner")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Ec2TransitGateway.MeteringPolicyEntry("example", new()
    {
        TransitGatewayMeteringPolicyId = exampleAwsEc2TransitGatewayMeteringPolicy.TransitGatewayMeteringPolicyId,
        PolicyRuleNumber = 100,
        MeteredAccount = "source-attachment-owner",
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2transitgateway.NewMeteringPolicyEntry(ctx, "example", &ec2transitgateway.MeteringPolicyEntryArgs{
			TransitGatewayMeteringPolicyId: pulumi.Any(exampleAwsEc2TransitGatewayMeteringPolicy.TransitGatewayMeteringPolicyId),
			PolicyRuleNumber:               pulumi.Int(100),
			MeteredAccount:                 pulumi.String("source-attachment-owner"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_ec2transitgateway_meteringpolicyentry" "example" {
  transit_gateway_metering_policy_id = exampleAwsEc2TransitGatewayMeteringPolicy.transitGatewayMeteringPolicyId
  policy_rule_number                 = 100
  metered_account                    = "source-attachment-owner"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.MeteringPolicyEntry;
import com.pulumi.aws.ec2transitgateway.MeteringPolicyEntryArgs;
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 MeteringPolicyEntry("example", MeteringPolicyEntryArgs.builder()
            .transitGatewayMeteringPolicyId(exampleAwsEc2TransitGatewayMeteringPolicy.transitGatewayMeteringPolicyId())
            .policyRuleNumber(100)
            .meteredAccount("source-attachment-owner")
            .build());

    }
}
resources:
  example:
    type: aws:ec2transitgateway:MeteringPolicyEntry
    properties:
      transitGatewayMeteringPolicyId: ${exampleAwsEc2TransitGatewayMeteringPolicy.transitGatewayMeteringPolicyId}
      policyRuleNumber: 100
      meteredAccount: source-attachment-owner

Full Traffic Matching Rule

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

const example = new aws.ec2transitgateway.MeteringPolicyEntry("example", {
    transitGatewayMeteringPolicyId: exampleAwsEc2TransitGatewayMeteringPolicy.transitGatewayMeteringPolicyId,
    policyRuleNumber: 200,
    meteredAccount: "destination-attachment-owner",
    sourceCidrBlock: "10.0.0.0/8",
    destinationCidrBlock: "172.16.0.0/12",
    protocol: "6",
});
import pulumi
import pulumi_aws as aws

example = aws.ec2transitgateway.MeteringPolicyEntry("example",
    transit_gateway_metering_policy_id=example_aws_ec2_transit_gateway_metering_policy["transitGatewayMeteringPolicyId"],
    policy_rule_number=200,
    metered_account="destination-attachment-owner",
    source_cidr_block="10.0.0.0/8",
    destination_cidr_block="172.16.0.0/12",
    protocol="6")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Ec2TransitGateway.MeteringPolicyEntry("example", new()
    {
        TransitGatewayMeteringPolicyId = exampleAwsEc2TransitGatewayMeteringPolicy.TransitGatewayMeteringPolicyId,
        PolicyRuleNumber = 200,
        MeteredAccount = "destination-attachment-owner",
        SourceCidrBlock = "10.0.0.0/8",
        DestinationCidrBlock = "172.16.0.0/12",
        Protocol = "6",
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2transitgateway.NewMeteringPolicyEntry(ctx, "example", &ec2transitgateway.MeteringPolicyEntryArgs{
			TransitGatewayMeteringPolicyId: pulumi.Any(exampleAwsEc2TransitGatewayMeteringPolicy.TransitGatewayMeteringPolicyId),
			PolicyRuleNumber:               pulumi.Int(200),
			MeteredAccount:                 pulumi.String("destination-attachment-owner"),
			SourceCidrBlock:                pulumi.String("10.0.0.0/8"),
			DestinationCidrBlock:           pulumi.String("172.16.0.0/12"),
			Protocol:                       pulumi.String("6"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_ec2transitgateway_meteringpolicyentry" "example" {
  transit_gateway_metering_policy_id = exampleAwsEc2TransitGatewayMeteringPolicy.transitGatewayMeteringPolicyId
  policy_rule_number                 = 200
  metered_account                    = "destination-attachment-owner"
  source_cidr_block                  = "10.0.0.0/8"
  destination_cidr_block             = "172.16.0.0/12"
  protocol                           = "6"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.MeteringPolicyEntry;
import com.pulumi.aws.ec2transitgateway.MeteringPolicyEntryArgs;
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 MeteringPolicyEntry("example", MeteringPolicyEntryArgs.builder()
            .transitGatewayMeteringPolicyId(exampleAwsEc2TransitGatewayMeteringPolicy.transitGatewayMeteringPolicyId())
            .policyRuleNumber(200)
            .meteredAccount("destination-attachment-owner")
            .sourceCidrBlock("10.0.0.0/8")
            .destinationCidrBlock("172.16.0.0/12")
            .protocol("6")
            .build());

    }
}
resources:
  example:
    type: aws:ec2transitgateway:MeteringPolicyEntry
    properties:
      transitGatewayMeteringPolicyId: ${exampleAwsEc2TransitGatewayMeteringPolicy.transitGatewayMeteringPolicyId}
      policyRuleNumber: 200
      meteredAccount: destination-attachment-owner
      sourceCidrBlock: 10.0.0.0/8
      destinationCidrBlock: 172.16.0.0/12
      protocol: '6'

Import

Using pulumi import, import aws.ec2transitgateway.MeteringPolicyEntry using the composite identifier. For example:

$ pulumi import aws:ec2transitgateway/meteringPolicyEntry:MeteringPolicyEntry example tgw-policy-12345678,100

Constructors

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

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
destinationCidrBlock ↔ Output<String?>
Destination CIDR block to match. If not specified, all destination CIDR blocks are matched.
latefinal
destinationPortRange ↔ Output<String?>
latefinal
destinationTransitGatewayAttachmentId ↔ Output<String?>
latefinal
destinationTransitGatewayAttachmentType ↔ Output<String?>
Destination attachment resource type to match. Valid values are vpc, vpn, direct-connect-gateway, connect, peering, tgw-peering.
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
meteredAccount ↔ Output<String>
The account to charge for matching traffic. Valid values are source-attachment-owner or destination-attachment-owner.
latefinal
policyRuleNumber ↔ Output<int>
Rule number for this entry. Lower numbers have higher priority. Valid values are between 1 and 32766.
latefinal
protocol ↔ Output<String?>
Protocol number to match (e.g., 6 for TCP, 17 for UDP). If not specified, all protocols are matched.
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
sourceCidrBlock ↔ Output<String?>
Source CIDR block to match. If not specified, all source CIDR blocks are matched.
latefinal
sourcePortRange ↔ Output<String?>
latefinal
sourceTransitGatewayAttachmentId ↔ Output<String?>
latefinal
sourceTransitGatewayAttachmentType ↔ Output<String?>
Source attachment resource type to match. Valid values are vpc, vpn, direct-connect-gateway, connect, peering, tgw-peering.
latefinal
timeouts ↔ Output<MeteringPolicyEntryTimeouts?>
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
transitGatewayMeteringPolicyId ↔ Output<String>
EC2 Transit Gateway Metering Policy identifier.
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, {MeteringPolicyEntryState? state, CustomResourceOptions? options}) → MeteringPolicyEntry
Gets an existing MeteringPolicyEntry resource's state with the given name and id.