Skip to content
Open
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
18 changes: 14 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ variable "ports" {
variable "ami" {
default = ""
}
variable "ami_owner_filter_values" {
type = list(string)
description = "List of AMI owners to limit search. Valid values: an AWS account ID, self (the current account), or an AWS owner alias (e.g., amazon, aws-marketplace, microsoft)"
default = ["amazon"]
}
variable "ami_name_filter_values" {
type = list(string)
description = "List of strings to use as the value of the name filter for the AMI to use"
default = ["amzn-ami-vpc-nat*"]
}
variable "internet_access" {
default = true
}
Expand All @@ -36,11 +46,11 @@ variable "s3_endpoint" {
data "aws_ami" "nat" {
count = var.ami == "" ? 1 : 0
most_recent = true
owners = ["amazon"]
owners = var.ami_owner_filter_values

filter {
name = "name"
values = ["amzn-ami-vpc-nat*"]
values = var.ami_name_filter_values
}
}
data "aws_subnet" "nat" {
Expand All @@ -56,12 +66,12 @@ locals {
client_subnet_cidrs = var.client_subnet_cidrs
az = data.aws_subnet.nat.availability_zone
ports = var.ports
ami = var.ami == "" ? data.aws_ami.nat[length(data.aws_ami.nat)].id : var.ami
ami = var.ami == "" ? data.aws_ami.nat[0].id : var.ami
internet_route = var.internet_access == true ? 1 : 0
s3_endpoint = var.s3_endpoint == true ? 1 : 0
tags = merge({
Name = local.name
Module = "Nat Instance"
ModuleSource = "https://github.com/jetbrains-infra/terraform-aws-nat-instance/"
}, var.tags)
}
}