Skip to content

Commit

Permalink
fix: support for 32-bit ASN (#52)
Browse files Browse the repository at this point in the history
* Added support for 32-bit ASN

The variable `customer_gateway_bgp_asn` now automatically sets `bgp_asn` or `bgp_asn_extended` whether the value cannot be represented as a 32-bit number

* Applied terraform format

* Updated versions.tf

* Updated references according to AWS provider version

* Updated references according to AWS provider version
  • Loading branch information
riccardolocci authored Oct 30, 2024
1 parent b097579 commit 086af94
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ Available targets:
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.53.0 |

## Providers

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

## Modules

Expand Down
4 changes: 2 additions & 2 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.53.0 |

## Providers

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

## Modules

Expand Down
13 changes: 7 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ resource "aws_vpn_gateway" "default" {

# https://www.terraform.io/docs/providers/aws/r/customer_gateway.html
resource "aws_customer_gateway" "default" {
count = local.enabled && var.customer_gateway_ip_address != null ? 1 : 0
device_name = module.this.id
bgp_asn = var.customer_gateway_bgp_asn
ip_address = var.customer_gateway_ip_address
type = "ipsec.1"
tags = module.this.tags
count = local.enabled && var.customer_gateway_ip_address != null ? 1 : 0
device_name = module.this.id
bgp_asn = var.customer_gateway_bgp_asn <= 2147483647 ? var.customer_gateway_bgp_asn : null
bgp_asn_extended = var.customer_gateway_bgp_asn > 2147483647 ? var.customer_gateway_bgp_asn : null
ip_address = var.customer_gateway_ip_address
type = "ipsec.1"
tags = module.this.tags

lifecycle {
create_before_destroy = true
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 2.0"
version = ">= 5.53.0"
}
}
}

0 comments on commit 086af94

Please sign in to comment.