MeteringPolicy class
Manages an EC2 Transit Gateway Metering Policy for Flexible Cost Allocation (FCA). A metering policy defines how traffic is metered for cost allocation purposes on a Transit Gateway.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2transitgateway.TransitGateway("example", {tags: {
Name: "example",
}});
const exampleMeteringPolicy = new aws.ec2transitgateway.MeteringPolicy("example", {
transitGatewayId: example.id,
tags: {
Name: "example",
},
});
import pulumi
import pulumi_aws as aws
example = aws.ec2transitgateway.TransitGateway("example", tags={
"Name": "example",
})
example_metering_policy = aws.ec2transitgateway.MeteringPolicy("example",
transit_gateway_id=example.id,
tags={
"Name": "example",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2TransitGateway.TransitGateway("example", new()
{
Tags =
{
{ "Name", "example" },
},
});
var exampleMeteringPolicy = new Aws.Ec2TransitGateway.MeteringPolicy("example", new()
{
TransitGatewayId = example.Id,
Tags =
{
{ "Name", "example" },
},
});
});
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 {
example, err := ec2transitgateway.NewTransitGateway(ctx, "example", &ec2transitgateway.TransitGatewayArgs{
Tags: pulumi.StringMap{
"Name": pulumi.String("example"),
},
})
if err != nil {
return err
}
_, err = ec2transitgateway.NewMeteringPolicy(ctx, "example", &ec2transitgateway.MeteringPolicyArgs{
TransitGatewayId: example.ID().ToIDOutput().ToStringOutput(),
Tags: pulumi.StringMap{
"Name": pulumi.String("example"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2transitgateway_transitgateway" "example" {
tags = {
"Name" = "example"
}
}
resource "aws_ec2transitgateway_meteringpolicy" "example" {
transit_gateway_id = aws_ec2transitgateway_transitgateway.example.id
tags = {
"Name" = "example"
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.TransitGateway;
import com.pulumi.aws.ec2transitgateway.TransitGatewayArgs;
import com.pulumi.aws.ec2transitgateway.MeteringPolicy;
import com.pulumi.aws.ec2transitgateway.MeteringPolicyArgs;
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 TransitGateway("example", TransitGatewayArgs.builder()
.tags(Map.of("Name", "example"))
.build());
var exampleMeteringPolicy = new MeteringPolicy("exampleMeteringPolicy", MeteringPolicyArgs.builder()
.transitGatewayId(example.id())
.tags(Map.of("Name", "example"))
.build());
}
}
resources:
example:
type: aws:ec2transitgateway:TransitGateway
properties:
tags:
Name: example
exampleMeteringPolicy:
type: aws:ec2transitgateway:MeteringPolicy
name: example
properties:
transitGatewayId: ${example.id}
tags:
Name: example
With Middlebox Attachments
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2transitgateway.MeteringPolicy("example", {
transitGatewayId: exampleAwsEc2TransitGateway.id,
middleboxAttachmentIds: [exampleAwsEc2TransitGatewayVpcAttachment.id],
tags: {
Name: "example",
},
});
import pulumi
import pulumi_aws as aws
example = aws.ec2transitgateway.MeteringPolicy("example",
transit_gateway_id=example_aws_ec2_transit_gateway["id"],
middlebox_attachment_ids=[example_aws_ec2_transit_gateway_vpc_attachment["id"]],
tags={
"Name": "example",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2TransitGateway.MeteringPolicy("example", new()
{
TransitGatewayId = exampleAwsEc2TransitGateway.Id,
MiddleboxAttachmentIds = new[]
{
exampleAwsEc2TransitGatewayVpcAttachment.Id,
},
Tags =
{
{ "Name", "example" },
},
});
});
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.NewMeteringPolicy(ctx, "example", &ec2transitgateway.MeteringPolicyArgs{
TransitGatewayId: pulumi.Any(exampleAwsEc2TransitGateway.Id),
MiddleboxAttachmentIds: pulumi.StringArray{
exampleAwsEc2TransitGatewayVpcAttachment.Id,
},
Tags: pulumi.StringMap{
"Name": pulumi.String("example"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2transitgateway_meteringpolicy" "example" {
transit_gateway_id = exampleAwsEc2TransitGateway.id
middlebox_attachment_ids = [exampleAwsEc2TransitGatewayVpcAttachment.id]
tags = {
"Name" = "example"
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.MeteringPolicy;
import com.pulumi.aws.ec2transitgateway.MeteringPolicyArgs;
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 MeteringPolicy("example", MeteringPolicyArgs.builder()
.transitGatewayId(exampleAwsEc2TransitGateway.id())
.middleboxAttachmentIds(exampleAwsEc2TransitGatewayVpcAttachment.id())
.tags(Map.of("Name", "example"))
.build());
}
}
resources:
example:
type: aws:ec2transitgateway:MeteringPolicy
properties:
transitGatewayId: ${exampleAwsEc2TransitGateway.id}
middleboxAttachmentIds:
- ${exampleAwsEc2TransitGatewayVpcAttachment.id}
tags:
Name: example
Import
Identity Schema
Required
transitGatewayMeteringPolicyId(String) ID of the EC2 Transit Gateway Metering Policy.
Optional
accountId(String) AWS Account where this resource is managed.region(String) Region where this resource is managed.
Using pulumi import, import EC2 Transit Gateway Metering Policies using the transitGatewayMeteringPolicyId. For example:
$ pulumi import aws:ec2transitgateway/meteringPolicy:MeteringPolicy example tgw-mp-12345678
Constructors
- MeteringPolicy(String name, {MeteringPolicyArgs? args, CustomResourceOptions? options})
-
Creates a new MeteringPolicy.
nameThe Pulumi resource name.argsArguments used to configure this MeteringPolicy. The set of arguments for MeteringPolicy.optionsResource options controlling this resource's behavior. - MeteringPolicy.reference(String urn)
- Creates a typed reference to an existing MeteringPolicy resource.
Properties
-
arn
↔ Output<
String> -
EC2 Transit Gateway Metering Policy ARN.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
- 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
-
middleboxAttachmentIds
↔ Output<
List< String> ?> -
Set of Transit Gateway attachment IDs to designate as middlebox attachments for this metering policy.
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
-
Key-value tags for the EC2 Transit Gateway Metering Policy. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
A map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
timeouts
↔ Output<
MeteringPolicyTimeouts?> -
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
transitGatewayId
↔ Output<
String> -
EC2 Transit Gateway identifier.
latefinal
-
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, {MeteringPolicyState? state, CustomResourceOptions? options}) → MeteringPolicy -
Gets an existing MeteringPolicy resource's state with the given
nameandid.