aboutsummaryrefslogtreecommitdiff
path: root/app/models/backends/terraform_aws/backend_methods.rb
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-06-23 23:45:03 +0100
committerChristopher Baines <mail@cbaines.net>2018-06-23 23:45:03 +0100
commita60b2982ad8b2a9966fb16aa251ea21a376d711a (patch)
tree83597ea8546ab8d97dcd30ca67252985e04f7574 /app/models/backends/terraform_aws/backend_methods.rb
parentd1f04420a1890705d4c4965d3f3296edee578920 (diff)
downloadgovuk-mini-environment-admin-a60b2982ad8b2a9966fb16aa251ea21a376d711a.tar
govuk-mini-environment-admin-a60b2982ad8b2a9966fb16aa251ea21a376d711a.tar.gz
Switch to using the public AWS domain of the build machine
Rather than the configured domain, as the corresponding SSH key shouldn't change for the AWS domain (whereas it does for the configured domain, if the machine changes).
Diffstat (limited to 'app/models/backends/terraform_aws/backend_methods.rb')
-rw-r--r--app/models/backends/terraform_aws/backend_methods.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/models/backends/terraform_aws/backend_methods.rb b/app/models/backends/terraform_aws/backend_methods.rb
index 89509bd..b21c83e 100644
--- a/app/models/backends/terraform_aws/backend_methods.rb
+++ b/app/models/backends/terraform_aws/backend_methods.rb
@@ -20,8 +20,12 @@
module Backends::TerraformAws::BackendMethods
def create_data_snapshot
+ remote_host = backend_latest_terraform_state.output_value(
+ 'guix_daemon_public_dns'
+ )
+
GovukGuix::CreateDataSnapshotJob.enqueue(
- run_remotely_on_host: "ubuntu@guix-daemon.#{domain}",
+ run_remotely_on_host: "ubuntu@#{remote_host}",
backend_type: self.class.name,
backend_id: id
)
@@ -101,6 +105,10 @@ module Backends::TerraformAws::BackendMethods
)
end
+ def backend_latest_terraform_state
+ backend_terraform_states.order(:id).last
+ end
+
def status
latest_terraform_state = backend_terraform_states.order(:id).last