-
Notifications
You must be signed in to change notification settings - Fork 44
Add variable to specify the bastion host #395
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changes in this file appear unnecessary. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,10 @@ variable "hieradata_dir" {} | |
| variable "eyaml_key" {} | ||
| variable "puppetfile" {} | ||
|
|
||
| variable "bastion_remote" { | ||
| default = {} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No default value if we move th variable |
||
| } | ||
|
|
||
| locals { | ||
| provision_folder = "etc_puppetlabs" | ||
| } | ||
|
|
@@ -69,9 +73,9 @@ resource "terraform_data" "deploy_puppetserver_files" { | |
| connection { | ||
| type = "ssh" | ||
| agent = false | ||
| bastion_host = contains(local.bastion_host.tags, "public") ? local.bastion_host.public_ip : local.bastion_host.local_ip | ||
| bastion_user = "tf" | ||
| bastion_private_key = var.configuration.ssh_key.private | ||
| bastion_host = coalesce(var.bastion_remote.host, contains(local.bastion_host.tags, "public") ? local.bastion_host.public_ip : local.bastion_host.local_ip) | ||
| bastion_user = coalesce(var.bastion_remote.user, "tf") | ||
| bastion_private_key = coalesce(var.bastion_remote.private_key, var.configuration.ssh_key.private) | ||
| user = "tf" | ||
| host = each.value | ||
| private_key = var.configuration.ssh_key.private | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,11 +17,6 @@ module "incus" { | |
| node = { type = "container", cpus = 2, ram = 3000, gpus = 0, tags = ["node"], count = 1 } | ||
| } | ||
|
|
||
| firewall_rules = { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep the firewall rules |
||
| http = { "from_port" = 80, "to_port" = 80, tag = "proxy", "cidr" = "0.0.0.0/0" }, | ||
| https = { "from_port" = 443, "to_port" = 443, tag = "proxy", "cidr" = "0.0.0.0/0" }, | ||
| } | ||
| bastion_tags = ["login"] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep the bastion_tags |
||
|
|
||
| volumes = {} | ||
|
|
||
|
|
@@ -40,6 +35,18 @@ module "incus" { | |
| # Set to true to make port 80 and 443 of the proxy container forwarded on the host | ||
| # There is a maximum of 1 cluster with forward_proxy = true per incus server. | ||
| forward_proxy = false | ||
|
|
||
| # Use the Incus host as bastion (useful when deploying using Incus remote) | ||
| # bastion_remote = { | ||
| # host = "<host ip>" | ||
| # user = "<user>" | ||
| # private_key = file("<path to private key>") | ||
| # } | ||
|
|
||
| # Use the local ip as bastion (when deploying Terraform directly from the Incus host) | ||
| bastion_remote = { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SSH-ing to self first before connecting to the puppetserver appears to be useless, but I could be wrong. |
||
| host = chomp(data.http.agent_ip.response_body) | ||
| } | ||
| } | ||
|
|
||
| output "accounts" { | ||
|
|
@@ -55,9 +62,10 @@ output "public_ip" { | |
| } | ||
|
|
||
|
|
||
| # data "http" "agent_ip" { | ||
| # url = "http://ipv4.icanhazip.com" | ||
| # } | ||
| data "http" "agent_ip" { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep it commented. |
||
| url = "http://ipv4.icanhazip.com" | ||
| } | ||
|
|
||
| # locals { | ||
| # public_instances = { for host, values in module.incus.public_instances: host => merge(values, { "public_ip" = chomp(data.http.agent_ip.response_body) }) } | ||
| # } | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this to common/variables.tf |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replicate this in aws/infrastructure.tf, azure/infrastructure.tf, gcp/infrastructure.tf, openstack/infrastructure.tf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in this file appear unnecessary.