aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-06-03 14:16:37 +0100
committerChristopher Baines <mail@cbaines.net>2018-06-03 14:16:37 +0100
commitd5616c7f0f9f36d640ad60a69d3b235efabe77e4 (patch)
tree612f5094944cfc768b04f812a183c5d255e77e20
parent084b086cf72260a5fe2379a35e8f5951a4ae9935 (diff)
downloadgovuk-mini-environment-admin-d5616c7f0f9f36d640ad60a69d3b235efabe77e4.tar
govuk-mini-environment-admin-d5616c7f0f9f36d640ad60a69d3b235efabe77e4.tar.gz
Extract the backend variables out in the AWS backend
-rw-r--r--app/models/backends/terraform_aws.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/app/models/backends/terraform_aws.rb b/app/models/backends/terraform_aws.rb
index c918a86..204eaf0 100644
--- a/app/models/backends/terraform_aws.rb
+++ b/app/models/backends/terraform_aws.rb
@@ -99,25 +99,29 @@ class Backends::TerraformAws < ApplicationRecord
end
end
- def deploy_backend
+ def backend_terraform_variables
public_ip_address = ENV[
'GOVUK_MINI_ENVIRONMENT_ADMIN_PUBLIC_IP_ADDRESS'
]
raise 'missing public ip address' if public_ip_address.nil?
+ common_terraform_variables.merge(
+ aws_vpc_id: vpc_id,
+ ssh_public_key: ssh_public_key,
+ backend_slug: label.parameterize,
+ mini_environment_admin_guix_public_key: guix_public_key,
+ mini_environment_admin_public_ip_address: public_ip_address
+ )
+ end
+
+ def deploy_backend
TerraformWorkingDirectory.new(
terraform_state_id,
'terraform/aws/backend'
).within_working_directory do
RubyTerraform.apply(
- vars: common_terraform_variables.merge(
- aws_vpc_id: vpc_id,
- ssh_public_key: ssh_public_key,
- backend_slug: label.parameterize,
- mini_environment_admin_guix_public_key: guix_public_key,
- mini_environment_admin_public_ip_address: public_ip_address
- ),
+ vars: backend_terraform_variables,
auto_approve: true
)
end