diff options
4 files changed, 29 insertions, 2 deletions
diff --git a/app/models/backends/terraform_aws/mini_environment_methods.rb b/app/models/backends/terraform_aws/mini_environment_methods.rb index bdb0ab4..36fd70d 100644 --- a/app/models/backends/terraform_aws/mini_environment_methods.rb +++ b/app/models/backends/terraform_aws/mini_environment_methods.rb @@ -100,6 +100,8 @@ module Backends::TerraformAws::MiniEnvironmentMethods end def terraform_variables(mini_environment) + credentials = TerraformHttpBackendController.credentials + common_terraform_variables.merge( slug: mini_environment.name.parameterize, start_command: mini_environment.backend_data['build_output'], @@ -110,7 +112,9 @@ module Backends::TerraformAws::MiniEnvironmentMethods .routes .url_helpers .terraform_http_backend_path(terraform_state_id) - ) + ), + backend_remote_state_username: credentials[:name], + backend_remote_state_password: credentials[:password] ) end end diff --git a/app/models/backends/terraform_libvirt/mini_environment_methods.rb b/app/models/backends/terraform_libvirt/mini_environment_methods.rb index 4bf6adb..9b68d49 100644 --- a/app/models/backends/terraform_libvirt/mini_environment_methods.rb +++ b/app/models/backends/terraform_libvirt/mini_environment_methods.rb @@ -97,6 +97,7 @@ module Backends::TerraformLibvirt::MiniEnvironmentMethods end def terraform_variables(mini_environment) + credentials = TerraformHttpBackendController.credentials slug = mini_environment.name.parameterize { @@ -111,7 +112,9 @@ module Backends::TerraformLibvirt::MiniEnvironmentMethods .routes .url_helpers .terraform_http_backend_path(terraform_state_id) - ) + ), + backend_remote_state_username: credentials[:name], + backend_remote_state_password: credentials[:password] } end end diff --git a/terraform/aws/mini_environment/main.tf b/terraform/aws/mini_environment/main.tf index a0d066a..7f2ebf6 100644 --- a/terraform/aws/mini_environment/main.tf +++ b/terraform/aws/mini_environment/main.tf @@ -30,6 +30,14 @@ variable "backend_remote_state_address" { type = "string" } +variable "backend_remote_state_username" { + type = "string" +} + +variable "backend_remote_state_password" { + type = "string" +} + variable "ssh_private_key" { type = "string" } @@ -45,6 +53,8 @@ data "terraform_remote_state" "backend" { backend = "http" config { address = "${var.backend_remote_state_address}" + username = "${var.backend_remote_state_username}" + password = "${var.backend_remote_state_password}" } } diff --git a/terraform/libvirt/mini_environment/main.tf b/terraform/libvirt/mini_environment/main.tf index 504574c..f572df6 100644 --- a/terraform/libvirt/mini_environment/main.tf +++ b/terraform/libvirt/mini_environment/main.tf @@ -2,6 +2,14 @@ variable "backend_remote_state_address" { type = "string" } +variable "backend_remote_state_username" { + type = "string" +} + +variable "backend_remote_state_password" { + type = "string" +} + variable "machine_name" { type = "string" } @@ -30,6 +38,8 @@ data "terraform_remote_state" "backend" { backend = "http" config { address = "${var.backend_remote_state_address}" + username = "${var.backend_remote_state_username}" + password = "${var.backend_remote_state_password}" } } |