Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hazelops/terraform-aws-ec2-nat

Terraform EC2 NAT Host Module
https://github.com/hazelops/terraform-aws-ec2-nat

Last synced: 19 days ago
JSON representation

Terraform EC2 NAT Host Module

Awesome Lists containing this project

README

        

# Terraform EC2 NAT Host Module

[AWS Doc about VPC NAT Instance](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_NAT_Instance.html#NATInstance)

## Usage

```hcl
module "nat_instance" {
source = "hazelops/ec2-nat/aws"
version = "~> 3.0"
enabled = var.nat_gateway_enabled ? false : true
env = var.env
vpc_id = module.vpc.vpc_id
allowed_cidr_blocks = [module.vpc.vpc_cidr_block]
public_subnets = module.vpc.public_subnets
private_route_table_id = module.vpc.private_route_table_ids[0]
ec2_key_pair_name = var.ec2_key_pair_name
}
```

## Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 0.13 |

## Providers

| Name | Version |
|------|---------|
| [aws](#provider\_aws) | 5.77.0 |
| [template](#provider\_template) | n/a |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_eip.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource |
| [aws_eip_association.nat_instance](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip_association) | resource |
| [aws_instance.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance) | resource |
| [aws_route.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |
| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
| [aws_ami.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) | data source |
| [aws_availability_zones.all](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [template_file.ec2_user_data](https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [allowed\_cidr\_blocks](#input\_allowed\_cidr\_blocks) | List of network subnets that are allowed | `list(string)` |

[
"0.0.0.0/0"
]
| no |
| [architecture](#input\_architecture) | NAT instance architecture | `list(string)` |
[
"arm64"
]
| no |
| [ec2\_key\_pair\_name](#input\_ec2\_key\_pair\_name) | n/a | `any` | n/a | yes |
| [eip\_enabled](#input\_eip\_enabled) | Gives ability to enable or disable creation of Elastic IP | `bool` | `false` | no |
| [enabled](#input\_enabled) | Gives ability to enable or disable creation of NAT EC2 | `bool` | `false` | no |
| [env](#input\_env) | n/a | `any` | n/a | yes |
| [instance\_type](#input\_instance\_type) | NAT instance type | `string` | `"t4g.nano"` | no |
| [name](#input\_name) | NAT instance name | `string` | `"nat-instance"` | no |
| [private\_route\_table\_id](#input\_private\_route\_table\_id) | n/a | `any` | n/a | yes |
| [public\_subnets](#input\_public\_subnets) | n/a | `any` | n/a | yes |
| [vpc\_id](#input\_vpc\_id) | n/a | `any` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| [instance\_id](#output\_instance\_id) | n/a |
| [private\_ip](#output\_private\_ip) | n/a |
| [public\_ip](#output\_public\_ip) | n/a |
| [security\_group](#output\_security\_group) | n/a |