Skip to content

Commit 98d5f01

Browse files
committed
Add bastion_tags input variable
Allow bypass auto inference of bastion tags
1 parent 40eb3f7 commit 98d5f01

9 files changed

Lines changed: 24 additions & 2 deletions

File tree

aws/infrastructure.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module "design" {
1313
pool = var.pool
1414
volumes = var.volumes
1515
firewall_rules = var.firewall_rules
16+
bastion_tags = var.bastion_tags
1617
}
1718

1819
module "configuration" {

azure/infrastructure.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module "design" {
1313
pool = var.pool
1414
volumes = var.volumes
1515
firewall_rules = var.firewall_rules
16+
bastion_tags = var.bastion_tags
1617
}
1718

1819
module "configuration" {

common/design/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ locals {
5656
# and we memorize the corresponding tags so we can determine which instances can be used as a
5757
# first hop when transferring files or executing remote commands with Terraform.
5858
agent_ip = chomp(data.http.agent_ip.response_body)
59-
bastion_tags = [
59+
bastion_tags = distinct(concat(var.bastion_tags, [
6060
for rule, values in var.firewall_rules :
6161
values.tag
6262
if values.ethertype == "IPv4" &&
@@ -66,7 +66,7 @@ locals {
6666
tonumber(split(".", strcontains(values.cidr, "/") ? cidrhost(values.cidr, 0) : values.cidr)[i]) <= tonumber(v) &&
6767
tonumber(split(".", strcontains(values.cidr, "/") ? cidrhost(values.cidr, -1) : values.cidr)[i]) >= tonumber(v)
6868
])
69-
]
69+
]))
7070
}
7171

7272
check "disk_space_per_tag" {

common/design/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ variable "pool" {}
66
variable "firewall_rules" {}
77
variable "min_disk_size" {}
88
variable "image" {}
9+
variable "bastion_tags" {}

common/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,9 @@ variable "eyaml_key" {
169169
error_message = "Unsupported private key format"
170170
}
171171
}
172+
173+
variable "bastion_tags" {
174+
type = list(string)
175+
default = []
176+
description = "Tags identifying instances that can be used by Terraform as the first hop to transfer files to the Puppet server."
177+
}

docs/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,16 @@ install complementary modules with [r10k](https://github.com/puppetlabs/r10k).
960960
**Post build modification effect**: trigger scp of Puppetfile at next `terraform apply`.
961961
Each instance's Puppet agent will be reloaded following the installation of the new modules.
962962
963+
### 4.22 bastion_tags (optional)
964+
965+
**default_value** = `[]`
966+
967+
Defines a list of tags identifying instances that can be used by Terraform as the first hop
968+
to transfer files to the Puppet server. By default, this list is infered from the list of
969+
[firewall rules](#416-firewall_rules-optional) and the public ip address of the agent calling
970+
`terraform apply`. Providing an explicit list of tags allow to bypass the firewall rule inference,
971+
which can be useful when the agent is in the same network as the cluster.
972+
963973
## 5. Cloud Specific Configuration
964974
965975
### 5.1 Amazon Web Services

gcp/infrastructure.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module "design" {
1313
pool = var.pool
1414
volumes = var.volumes
1515
firewall_rules = var.firewall_rules
16+
bastion_tags = var.bastion_tags
1617
}
1718

1819
module "configuration" {

incus/infrastructure.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module "design" {
88
pool = var.pool
99
volumes = var.volumes
1010
firewall_rules = var.firewall_rules
11+
bastion_tags = var.bastion_tags
1112
}
1213

1314
module "configuration" {

openstack/infrastructure.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module "design" {
88
pool = var.pool
99
volumes = var.volumes
1010
firewall_rules = var.firewall_rules
11+
bastion_tags = var.bastion_tags
1112
}
1213

1314
module "configuration" {

0 commit comments

Comments
 (0)