From e6d03158765d3b06782e20649374f5c17fcba530 Mon Sep 17 00:00:00 2001 From: hlazrv Date: Wed, 29 May 2024 18:24:38 +0000 Subject: [PATCH 1/3] docs: add example for: awscc_ec2_transit_gateway_route_table_association --- ...transit_gateway_route_table_association.md | 57 ++++++++++++++++++- ...transit_gateway_route_table_association.tf | 49 ++++++++++++++++ ...it_gateway_route_table_association.md.tmpl | 28 +++++++++ 3 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 examples/resources/awscc_ec2_transit_gateway_route_table_association/ec2_transit_gateway_route_table_association.tf create mode 100644 templates/resources/ec2_transit_gateway_route_table_association.md.tmpl diff --git a/docs/resources/ec2_transit_gateway_route_table_association.md b/docs/resources/ec2_transit_gateway_route_table_association.md index 936915266..84e5b3d6d 100644 --- a/docs/resources/ec2_transit_gateway_route_table_association.md +++ b/docs/resources/ec2_transit_gateway_route_table_association.md @@ -1,5 +1,4 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "awscc_ec2_transit_gateway_route_table_association Resource - terraform-provider-awscc" subcategory: "" description: |- @@ -10,6 +9,60 @@ description: |- Resource Type definition for AWS::EC2::TransitGatewayRouteTableAssociation +## Example Usage + +### First example +Associates the specified attachment with the specified transit gateway route table. You can associate one route table with an attachment. +```terraform +#Creates a transit gateway route table association +resource "awscc_ec2_transit_gateway_route_table_association" "transit_gateway_rt_association_example" { + transit_gateway_attachment_id = awscc_ec2_transit_gateway_attachment.transit_gateway_attachment_example.id + transit_gateway_route_table_id = awscc_ec2_transit_gateway_route_table.transit_gateway_rt_example.id +} + +#Create a transit gateway attachment +resource "awscc_ec2_transit_gateway_attachment" "transit_gateway_attachment_example" { + subnet_ids = [aws_subnet.example.id] + transit_gateway_id = awscc_ec2_transit_gateway.transit_gateway_example.id + vpc_id = aws_vpc.example.id +} + +# Create an VPC +resource "aws_vpc" "example" { + cidr_block = "10.0.0.0/16" + enable_dns_support = true + enable_dns_hostnames = true + tags = { + Name = "MainVPC" + } +} + +# Create a public subnet +resource "aws_subnet" "example" { + vpc_id = aws_vpc.example.id + cidr_block = "10.0.0.0/24" + tags = { + Name = "PublicSubnet" + } + + depends_on = [aws_vpc.example] +} + +# Create a transit gateway +resource "awscc_ec2_transit_gateway" "transit_gateway_example" { + amazon_side_asn = 64512 + auto_accept_shared_attachments = "enable" + default_route_table_association = "disable" + default_route_table_propagation = "disable" + dns_support = "enable" + vpn_ecmp_support = "enable" +} + +# Create a transit gateway route table +resource "awscc_ec2_transit_gateway_route_table" "transit_gateway_rt_example" { + transit_gateway_id = awscc_ec2_transit_gateway.transit_gateway_example.id +} +``` @@ -30,4 +83,4 @@ Import is supported using the following syntax: ```shell $ terraform import awscc_ec2_transit_gateway_route_table_association.example -``` +``` \ No newline at end of file diff --git a/examples/resources/awscc_ec2_transit_gateway_route_table_association/ec2_transit_gateway_route_table_association.tf b/examples/resources/awscc_ec2_transit_gateway_route_table_association/ec2_transit_gateway_route_table_association.tf new file mode 100644 index 000000000..207a4996f --- /dev/null +++ b/examples/resources/awscc_ec2_transit_gateway_route_table_association/ec2_transit_gateway_route_table_association.tf @@ -0,0 +1,49 @@ +#Creates a transit gateway route table association +resource "awscc_ec2_transit_gateway_route_table_association" "transit_gateway_rt_association_example" { + transit_gateway_attachment_id = awscc_ec2_transit_gateway_attachment.transit_gateway_attachment_example.id + transit_gateway_route_table_id = awscc_ec2_transit_gateway_route_table.transit_gateway_rt_example.id +} + +#Create a transit gateway attachment +resource "awscc_ec2_transit_gateway_attachment" "transit_gateway_attachment_example" { + subnet_ids = [aws_subnet.example.id] + transit_gateway_id = awscc_ec2_transit_gateway.transit_gateway_example.id + vpc_id = aws_vpc.example.id +} + +# Create an VPC +resource "aws_vpc" "example" { + cidr_block = "10.0.0.0/16" + enable_dns_support = true + enable_dns_hostnames = true + tags = { + Name = "MainVPC" + } +} + +# Create a public subnet +resource "aws_subnet" "example" { + vpc_id = aws_vpc.example.id + cidr_block = "10.0.0.0/24" + tags = { + Name = "PublicSubnet" + } + + depends_on = [aws_vpc.example] +} + +# Create a transit gateway +resource "awscc_ec2_transit_gateway" "transit_gateway_example" { + amazon_side_asn = 64512 + auto_accept_shared_attachments = "enable" + default_route_table_association = "disable" + default_route_table_propagation = "disable" + dns_support = "enable" + vpn_ecmp_support = "enable" +} + +# Create a transit gateway route table +resource "awscc_ec2_transit_gateway_route_table" "transit_gateway_rt_example" { + transit_gateway_id = awscc_ec2_transit_gateway.transit_gateway_example.id +} + diff --git a/templates/resources/ec2_transit_gateway_route_table_association.md.tmpl b/templates/resources/ec2_transit_gateway_route_table_association.md.tmpl new file mode 100644 index 000000000..e4f272e87 --- /dev/null +++ b/templates/resources/ec2_transit_gateway_route_table_association.md.tmpl @@ -0,0 +1,28 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage + +### First example +Associates the specified attachment with the specified transit gateway route table. You can associate one route table with an attachment. +{{ tffile (printf "examples/resources/%s/ec2_transit_gateway_route_table_association.tf" .Name)}} + + +{{ .SchemaMarkdown | trimspace }} +{{- if .HasImport }} + +## Import + +Import is supported using the following syntax: + +{{ codefile "shell" .ImportFile }} + +{{- end }} \ No newline at end of file From b10f8384a30dd5987155cd3064d5f51437bc8bc1 Mon Sep 17 00:00:00 2001 From: hlazrv Date: Mon, 3 Jun 2024 20:27:10 +0000 Subject: [PATCH 2/3] add example for awscc_ec2_transit_gateway_route_table_association --- ...transit_gateway_route_table_association.md | 56 ++++++++----------- ...transit_gateway_route_table_association.tf | 55 ++++++++---------- ...it_gateway_route_table_association.md.tmpl | 2 - 3 files changed, 48 insertions(+), 65 deletions(-) diff --git a/docs/resources/ec2_transit_gateway_route_table_association.md b/docs/resources/ec2_transit_gateway_route_table_association.md index 84e5b3d6d..1552bf5e4 100644 --- a/docs/resources/ec2_transit_gateway_route_table_association.md +++ b/docs/resources/ec2_transit_gateway_route_table_association.md @@ -10,57 +10,49 @@ description: |- Resource Type definition for AWS::EC2::TransitGatewayRouteTableAssociation ## Example Usage - -### First example Associates the specified attachment with the specified transit gateway route table. You can associate one route table with an attachment. ```terraform #Creates a transit gateway route table association -resource "awscc_ec2_transit_gateway_route_table_association" "transit_gateway_rt_association_example" { - transit_gateway_attachment_id = awscc_ec2_transit_gateway_attachment.transit_gateway_attachment_example.id - transit_gateway_route_table_id = awscc_ec2_transit_gateway_route_table.transit_gateway_rt_example.id +resource "awscc_ec2_transit_gateway_route_table_association" "example" { + transit_gateway_attachment_id = awscc_ec2_transit_gateway_attachment.example.id + transit_gateway_route_table_id = awscc_ec2_transit_gateway_route_table.example.id } #Create a transit gateway attachment -resource "awscc_ec2_transit_gateway_attachment" "transit_gateway_attachment_example" { - subnet_ids = [aws_subnet.example.id] - transit_gateway_id = awscc_ec2_transit_gateway.transit_gateway_example.id - vpc_id = aws_vpc.example.id -} +resource "awscc_ec2_transit_gateway_attachment" "example" { + subnet_ids =[ awscc_ec2_subnet.example.id ] + transit_gateway_id = awscc_ec2_transit_gateway.example.id + vpc_id = awscc_ec2_vpc.example.id +} # Create an VPC -resource "aws_vpc" "example" { - cidr_block = "10.0.0.0/16" - enable_dns_support = true - enable_dns_hostnames = true - tags = { - Name = "MainVPC" - } +resource "awscc_ec2_vpc" "example" { + cidr_block = "10.0.0.0/16" + enable_dns_support = true + enable_dns_hostnames = true } # Create a public subnet -resource "aws_subnet" "example" { - vpc_id = aws_vpc.example.id - cidr_block = "10.0.0.0/24" - tags = { - Name = "PublicSubnet" - } - - depends_on = [aws_vpc.example] +resource "awscc_ec2_subnet" "example" { + vpc_id = awscc_ec2_vpc.example.id + cidr_block = "10.0.0.0/24" + + depends_on = [awscc_ec2_vpc.example] } # Create a transit gateway -resource "awscc_ec2_transit_gateway" "transit_gateway_example" { - amazon_side_asn = 64512 - auto_accept_shared_attachments = "enable" +resource "awscc_ec2_transit_gateway" "example" { + amazon_side_asn = 64512 + auto_accept_shared_attachments = "enable" default_route_table_association = "disable" default_route_table_propagation = "disable" - dns_support = "enable" - vpn_ecmp_support = "enable" + dns_support = "enable" + vpn_ecmp_support = "enable" } # Create a transit gateway route table -resource "awscc_ec2_transit_gateway_route_table" "transit_gateway_rt_example" { - transit_gateway_id = awscc_ec2_transit_gateway.transit_gateway_example.id +resource "awscc_ec2_transit_gateway_route_table" "example" { + transit_gateway_id = awscc_ec2_transit_gateway.example.id } ``` diff --git a/examples/resources/awscc_ec2_transit_gateway_route_table_association/ec2_transit_gateway_route_table_association.tf b/examples/resources/awscc_ec2_transit_gateway_route_table_association/ec2_transit_gateway_route_table_association.tf index 207a4996f..9d19bba63 100644 --- a/examples/resources/awscc_ec2_transit_gateway_route_table_association/ec2_transit_gateway_route_table_association.tf +++ b/examples/resources/awscc_ec2_transit_gateway_route_table_association/ec2_transit_gateway_route_table_association.tf @@ -1,49 +1,42 @@ #Creates a transit gateway route table association -resource "awscc_ec2_transit_gateway_route_table_association" "transit_gateway_rt_association_example" { - transit_gateway_attachment_id = awscc_ec2_transit_gateway_attachment.transit_gateway_attachment_example.id - transit_gateway_route_table_id = awscc_ec2_transit_gateway_route_table.transit_gateway_rt_example.id +resource "awscc_ec2_transit_gateway_route_table_association" "example" { + transit_gateway_attachment_id = awscc_ec2_transit_gateway_attachment.example.id + transit_gateway_route_table_id = awscc_ec2_transit_gateway_route_table.example.id } #Create a transit gateway attachment -resource "awscc_ec2_transit_gateway_attachment" "transit_gateway_attachment_example" { - subnet_ids = [aws_subnet.example.id] - transit_gateway_id = awscc_ec2_transit_gateway.transit_gateway_example.id - vpc_id = aws_vpc.example.id -} +resource "awscc_ec2_transit_gateway_attachment" "example" { + subnet_ids =[ awscc_ec2_subnet.example.id ] + transit_gateway_id = awscc_ec2_transit_gateway.example.id + vpc_id = awscc_ec2_vpc.example.id +} # Create an VPC -resource "aws_vpc" "example" { - cidr_block = "10.0.0.0/16" - enable_dns_support = true - enable_dns_hostnames = true - tags = { - Name = "MainVPC" - } +resource "awscc_ec2_vpc" "example" { + cidr_block = "10.0.0.0/16" + enable_dns_support = true + enable_dns_hostnames = true } # Create a public subnet -resource "aws_subnet" "example" { - vpc_id = aws_vpc.example.id - cidr_block = "10.0.0.0/24" - tags = { - Name = "PublicSubnet" - } +resource "awscc_ec2_subnet" "example" { + vpc_id = awscc_ec2_vpc.example.id + cidr_block = "10.0.0.0/24" - depends_on = [aws_vpc.example] + depends_on = [awscc_ec2_vpc.example] } # Create a transit gateway -resource "awscc_ec2_transit_gateway" "transit_gateway_example" { - amazon_side_asn = 64512 - auto_accept_shared_attachments = "enable" +resource "awscc_ec2_transit_gateway" "example" { + amazon_side_asn = 64512 + auto_accept_shared_attachments = "enable" default_route_table_association = "disable" default_route_table_propagation = "disable" - dns_support = "enable" - vpn_ecmp_support = "enable" + dns_support = "enable" + vpn_ecmp_support = "enable" } # Create a transit gateway route table -resource "awscc_ec2_transit_gateway_route_table" "transit_gateway_rt_example" { - transit_gateway_id = awscc_ec2_transit_gateway.transit_gateway_example.id -} - +resource "awscc_ec2_transit_gateway_route_table" "example" { + transit_gateway_id = awscc_ec2_transit_gateway.example.id +} \ No newline at end of file diff --git a/templates/resources/ec2_transit_gateway_route_table_association.md.tmpl b/templates/resources/ec2_transit_gateway_route_table_association.md.tmpl index e4f272e87..ff4d6a532 100644 --- a/templates/resources/ec2_transit_gateway_route_table_association.md.tmpl +++ b/templates/resources/ec2_transit_gateway_route_table_association.md.tmpl @@ -10,8 +10,6 @@ description: |- {{ .Description | trimspace }} ## Example Usage - -### First example Associates the specified attachment with the specified transit gateway route table. You can associate one route table with an attachment. {{ tffile (printf "examples/resources/%s/ec2_transit_gateway_route_table_association.tf" .Name)}} From 68bc3eb2e895286229d30f91db6be6d666772349 Mon Sep 17 00:00:00 2001 From: hlazrv Date: Mon, 3 Jun 2024 20:30:50 +0000 Subject: [PATCH 3/3] add example for awscc_ec2_transit_gateway_route_table_association --- docs/resources/ec2_transit_gateway_route_table_association.md | 2 -- .../ec2_transit_gateway_route_table_association.tf | 2 -- 2 files changed, 4 deletions(-) diff --git a/docs/resources/ec2_transit_gateway_route_table_association.md b/docs/resources/ec2_transit_gateway_route_table_association.md index 1552bf5e4..5fa56e9f6 100644 --- a/docs/resources/ec2_transit_gateway_route_table_association.md +++ b/docs/resources/ec2_transit_gateway_route_table_association.md @@ -36,8 +36,6 @@ resource "awscc_ec2_vpc" "example" { resource "awscc_ec2_subnet" "example" { vpc_id = awscc_ec2_vpc.example.id cidr_block = "10.0.0.0/24" - - depends_on = [awscc_ec2_vpc.example] } # Create a transit gateway diff --git a/examples/resources/awscc_ec2_transit_gateway_route_table_association/ec2_transit_gateway_route_table_association.tf b/examples/resources/awscc_ec2_transit_gateway_route_table_association/ec2_transit_gateway_route_table_association.tf index 9d19bba63..4fd83c077 100644 --- a/examples/resources/awscc_ec2_transit_gateway_route_table_association/ec2_transit_gateway_route_table_association.tf +++ b/examples/resources/awscc_ec2_transit_gateway_route_table_association/ec2_transit_gateway_route_table_association.tf @@ -22,8 +22,6 @@ resource "awscc_ec2_vpc" "example" { resource "awscc_ec2_subnet" "example" { vpc_id = awscc_ec2_vpc.example.id cidr_block = "10.0.0.0/24" - - depends_on = [awscc_ec2_vpc.example] } # Create a transit gateway