Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update Terraform minimum supported version to v0.13.1 #68

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.62.3
rev: v1.64.0
hooks:
- id: terraform_fmt
- id: terraform_validate
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ module "vpc" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.26 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.15.0 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.15 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.15.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.15 |

## Modules

Expand Down
19 changes: 4 additions & 15 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

Configuration in this directory creates AWS Transit Gateway, attach VPC to it and share it with other AWS principals using [Resource Access Manager (RAM)](https://aws.amazon.com/ram/).

## Notes

There is a famous limitation in Terraform which prevents us from using computed values in `count`. For this reason this example is using data-sources to discover already created default VPC and subnets.

In real-world scenario you will have to split creation of VPC (using [terraform-aws-vpc modules](https://github.com/terraform-aws-modules/terraform-aws-vpc)) and creation of TGW resources using this module.

## Usage

To run this example you need to execute:
Expand All @@ -25,14 +19,12 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.26 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.24 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.15 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 2.24 |
No providers.

## Modules

Expand All @@ -44,10 +36,7 @@ Note that this example may create resources which cost money. Run `terraform des

## Resources

| Name | Type |
|------|------|
| [aws_subnet_ids.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source |
| [aws_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
No resources.

## Inputs

Expand Down
61 changes: 36 additions & 25 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
provider "aws" {
region = "eu-west-1"
region = local.region
}

# See Notes in README.md for explanation regarding using data-sources and computed values
data "aws_vpc" "default" {
default = true
}
locals {
name = "ex-tgw-${replace(basename(path.cwd), "_", "-")}"
region = "eu-west-1"

data "aws_subnet_ids" "this" {
vpc_id = data.aws_vpc.default.id
tags = {
Example = local.name
GithubRepo = "terraform-aws-eks"
GithubOrg = "terraform-aws-transit-gateway"
}
}

################################################################################
# Transit Gateway Module
################################################################################

module "tgw" {
source = "../../"

name = "my-tgw"
name = local.name
description = "My TGW shared with several other AWS accounts"
amazon_side_asn = 64532

enable_auto_accept_shared_attachments = true # When "true" there is no need for RAM resources if using multiple AWS accounts
# When "true" there is no need for RAM resources if using multiple AWS accounts
enable_auto_accept_shared_attachments = true

vpc_attachments = {
vpc1 = {
vpc_id = data.aws_vpc.default.id # module.vpc1.vpc_id
subnet_ids = data.aws_subnet_ids.this.ids # module.vpc1.private_subnets
dns_support = true
ipv6_support = true
vpc_id = module.vpc1.vpc_id
subnet_ids = module.vpc1.private_subnets
dns_support = true
ipv6_support = true

transit_gateway_default_route_table_association = false
transit_gateway_default_route_table_propagation = false
# transit_gateway_route_table_id = "tgw-rtb-073a181ee589b360f"

tgw_routes = [
{
Expand All @@ -41,8 +48,8 @@ module "tgw" {
]
},
vpc2 = {
vpc_id = data.aws_vpc.default.id # module.vpc2.vpc_id
subnet_ids = data.aws_subnet_ids.this.ids # module.vpc2.private_subnets
vpc_id = module.vpc2.vpc_id
subnet_ids = module.vpc2.private_subnets

tgw_routes = [
{
Expand All @@ -59,37 +66,41 @@ module "tgw" {
ram_allow_external_principals = true
ram_principals = [307990089504]

tags = {
Purpose = "tgw-complete-example"
}
tags = local.tags
}

################################################################################
# Supporting resources
################################################################################

module "vpc1" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 3.0"

name = "vpc1"

name = "${local.name}-vpc1"
cidr = "10.10.0.0/16"

azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
azs = ["${local.region}a", "${local.region}b", "${local.region}c"]
private_subnets = ["10.10.1.0/24", "10.10.2.0/24", "10.10.3.0/24"]

enable_ipv6 = true
private_subnet_assign_ipv6_address_on_creation = true
private_subnet_ipv6_prefixes = [0, 1, 2]

tags = local.tags
}

module "vpc2" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 3.0"

name = "vpc2"

name = "${local.name}-vpc2"
cidr = "10.20.0.0/16"

azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
azs = ["${local.region}a", "${local.region}b", "${local.region}c"]
private_subnets = ["10.20.1.0/24", "10.20.2.0/24", "10.20.3.0/24"]

enable_ipv6 = false

tags = local.tags
}
64 changes: 36 additions & 28 deletions examples/complete/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# aws_ec2_transit_gateway
################################################################################
# Transit Gateway
################################################################################

output "ec2_transit_gateway_arn" {
description = "EC2 Transit Gateway Amazon Resource Name (ARN)"
value = module.tgw.ec2_transit_gateway_arn
}

output "ec2_transit_gateway_association_default_route_table_id" {
description = "Identifier of the default association route table"
value = module.tgw.ec2_transit_gateway_association_default_route_table_id
}

output "ec2_transit_gateway_id" {
description = "EC2 Transit Gateway identifier"
value = module.tgw.ec2_transit_gateway_id
Expand All @@ -19,45 +17,54 @@ output "ec2_transit_gateway_owner_id" {
value = module.tgw.ec2_transit_gateway_owner_id
}

output "ec2_transit_gateway_association_default_route_table_id" {
description = "Identifier of the default association route table"
value = module.tgw.ec2_transit_gateway_association_default_route_table_id
}

output "ec2_transit_gateway_propagation_default_route_table_id" {
description = "Identifier of the default propagation route table"
value = module.tgw.ec2_transit_gateway_propagation_default_route_table_id
}

output "ec2_transit_gateway_route_table_default_association_route_table" {
description = "Boolean whether this is the default association route table for the EC2 Transit Gateway"
value = module.tgw.ec2_transit_gateway_route_table_default_association_route_table
################################################################################
# VPC Attachment
################################################################################

output "ec2_transit_gateway_vpc_attachment_ids" {
description = "List of EC2 Transit Gateway VPC Attachment identifiers"
value = module.tgw.ec2_transit_gateway_vpc_attachment_ids
}

output "ec2_transit_gateway_route_table_default_propagation_route_table" {
description = "Boolean whether this is the default propagation route table for the EC2 Transit Gateway"
value = module.tgw.ec2_transit_gateway_route_table_default_propagation_route_table
output "ec2_transit_gateway_vpc_attachment" {
description = "Map of EC2 Transit Gateway VPC Attachment attributes"
value = module.tgw.ec2_transit_gateway_vpc_attachment
}

# aws_ec2_transit_gateway_route_table
################################################################################
# Route Table / Routes
################################################################################

output "ec2_transit_gateway_route_table_id" {
description = "EC2 Transit Gateway Route Table identifier"
value = module.tgw.ec2_transit_gateway_route_table_id
}

# aws_ec2_transit_gateway_route
output "ec2_transit_gateway_route_ids" {
description = "List of EC2 Transit Gateway Route Table identifier combined with destination"
value = module.tgw.ec2_transit_gateway_route_ids
output "ec2_transit_gateway_route_table_default_association_route_table" {
description = "Boolean whether this is the default association route table for the EC2 Transit Gateway"
value = module.tgw.ec2_transit_gateway_route_table_default_association_route_table
}

# aws_ec2_transit_gateway_vpc_attachment
output "ec2_transit_gateway_vpc_attachment_ids" {
description = "List of EC2 Transit Gateway VPC Attachment identifiers"
value = module.tgw.ec2_transit_gateway_vpc_attachment_ids
output "ec2_transit_gateway_route_table_default_propagation_route_table" {
description = "Boolean whether this is the default propagation route table for the EC2 Transit Gateway"
value = module.tgw.ec2_transit_gateway_route_table_default_propagation_route_table
}

output "ec2_transit_gateway_vpc_attachment" {
description = "Map of EC2 Transit Gateway VPC Attachment attributes"
value = module.tgw.ec2_transit_gateway_vpc_attachment
output "ec2_transit_gateway_route_ids" {
description = "List of EC2 Transit Gateway Route Table identifier combined with destination"
value = module.tgw.ec2_transit_gateway_route_ids
}

# aws_ec2_transit_gateway_route_table_association
output "ec2_transit_gateway_route_table_association_ids" {
description = "List of EC2 Transit Gateway Route Table Association identifiers"
value = module.tgw.ec2_transit_gateway_route_table_association_ids
Expand All @@ -68,7 +75,6 @@ output "ec2_transit_gateway_route_table_association" {
value = module.tgw.ec2_transit_gateway_route_table_association
}

# aws_ec2_transit_gateway_route_table_propagation
output "ec2_transit_gateway_route_table_propagation_ids" {
description = "List of EC2 Transit Gateway Route Table Propagation identifiers"
value = module.tgw.ec2_transit_gateway_route_table_propagation_ids
Expand All @@ -79,13 +85,15 @@ output "ec2_transit_gateway_route_table_propagation" {
value = module.tgw.ec2_transit_gateway_route_table_propagation
}

# aws_ram_resource_share
################################################################################
# Resource Access Manager
################################################################################

output "ram_resource_share_id" {
description = "The Amazon Resource Name (ARN) of the resource share"
value = module.tgw.ram_resource_share_id
}

# aws_ram_principal_association
output "ram_principal_association_id" {
description = "The Amazon Resource Name (ARN) of the Resource Share and the principal, separated by a comma"
value = module.tgw.ram_principal_association_id
Expand Down
7 changes: 5 additions & 2 deletions examples/complete/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
terraform {
required_version = ">= 0.12.26"
required_version = ">= 0.13.1"

required_providers {
aws = ">= 2.24"
aws = {
source = "hashicorp/aws"
version = ">= 3.15"
}
}
}
20 changes: 5 additions & 15 deletions examples/multi-account/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

Configuration in this directory creates AWS Transit Gateway, attach VPC to it and share it with other AWS principals using [Resource Access Manager (RAM)](https://aws.amazon.com/ram/).

## Notes

There is a famous limitation in Terraform which prevents us from using computed values in `count`. For this reason this example is using data-sources to discover already created default VPC and subnets.

In real-world scenario you will have to split creation of VPC (using [terraform-aws-vpc modules](https://github.com/terraform-aws-modules/terraform-aws-vpc)) and creation of TGW resources using this module.

## Usage

To run this example you need to execute:
Expand All @@ -25,14 +19,12 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.26 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.24 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.15 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 2.24 |
No providers.

## Modules

Expand All @@ -41,13 +33,11 @@ Note that this example may create resources which cost money. Run `terraform des
| <a name="module_tgw"></a> [tgw](#module\_tgw) | ../../ | n/a |
| <a name="module_tgw_peer"></a> [tgw\_peer](#module\_tgw\_peer) | ../../ | n/a |
| <a name="module_vpc1"></a> [vpc1](#module\_vpc1) | terraform-aws-modules/vpc/aws | ~> 3.0 |
| <a name="module_vpc2"></a> [vpc2](#module\_vpc2) | terraform-aws-modules/vpc/aws | ~> 3.0 |

## Resources

| Name | Type |
|------|------|
| [aws_subnet_ids.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source |
| [aws_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
No resources.

## Inputs

Expand Down
Loading