Skip to main content

aws_ec2_transit_gateway_route_table Resource

Use the aws_ec2_transit_gateway_route_table InSpec audit resource to test properties of a single specific Transit Gateway route table association.

A Transit Gateway route table association associates the specified attachment with the specified Transit Gateway route table.

For additional information, including details on parameters and properties, see the AWS documentation on Transit Gateway route table.

Install

This resource is available in the Chef InSpec AWS resource pack.

For information on configuring your AWS environment for Chef InSpec and creating an InSpec profile that uses the InSpec AWS resource pack, see the Chef InSpec documentation on the AWS cloud platform.

Syntax

Ensure that a Transit Gateway route table ID exists.

describe aws_ec2_transit_gateway_route_table(transit_gateway_route_table_id: 'tgw-rtb-052d947d91b6bb69f') do
  it { should exist }
end

Parameters

transit_gateway_route_table_id (required)

The ID of the Transit Gateway route table.

Properties

transit_gateway_route_table_id
The ID of the Transit Gateway route table.
transit_gateway_id
The ID of the Transit Gateway.
state
The state of the route table. Relevant values are: available, deleting, deleted, and pending.
default_association_route_table
Indicates whether this is the default association route table for the Transit Gateway. Default values are true and false.
default_propagation_route_table
Indicates whether this is the default propagation route table for the Transit Gateway. Default values are true and false.
creation_time
The creation time of the Transit Gateway route table.
tags
The tags of the Transit Gateway route table.

Examples

Ensure a Transit Gateway route table ID is available.

describe aws_ec2_transit_gateway_route_table(transit_gateway_route_table_id: 'tgw-rtb-052d947d91b6bb69f') do
  its('transit_gateway_route_table_id') { should eq 'tgw-rtb-052d947d91b6bb69f' }
end

Ensure that the state is available or deleted.

describe aws_ec2_transit_gateway_route_table(transit_gateway_route_table_id: 'tgw-rtb-052d947d91b6bb69f') do
    its('state') { should eq 'available' }
end

Matchers

For a full list of available matchers, see our Universal Matchers page.

The controls will pass if the describe method returns at least one result.

exist

Use should to test that the entity exists.

describe aws_ec2_transit_gateway_route_table(transit_gateway_route_table_id: 'tgw-rtb-052d947d91b6bb69f') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_ec2_transit_gateway_route_table(transit_gateway_route_table_id: 'tgw-rtb-052d947d91b6bb69f') do
  it { should_not exist }
end

be_available

Check if the Transit Gateway route table ID is available.

describe aws_ec2_transit_gateway_route_table(transit_gateway_route_table_id: 'tgw-rtb-052d947d91b6bb69f') do
  it { should be_available }
end

Use should_not to test an Transit Gateway route table ID that should not exist.

describe aws_ec2_transit_gateway_route_table(transit_gateway_route_table_id: 'tgw-rtb-052d947d91b6bb69f') do
  it { should_not be_available }
end

AWS Permissions

Your Principal will need the ec2:describe_transit_gateway_route_tables action with Effect set to Allow.

See the Actions, Resources, and Condition Keys for Amazon EC2 documentation for additional information.

Edit this page on GitHub

Thank you for your feedback!

×