diff options
-rw-r--r-- | app/models/backends/terraform_aws.rb | 20 |
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 |