aboutsummaryrefslogtreecommitdiff
path: root/app/jobs
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-01-28 14:46:03 +0000
committerChristopher Baines <mail@cbaines.net>2018-03-29 07:28:09 +0100
commit97f6d7e326a1fd7ddcbe7cf32dc0e4c0a508913d (patch)
treefa2dceba69676cd0a2d35840fea69eb1422b52bd /app/jobs
parenteb3177b0d8de10f316ac595dff3b8165cf828796 (diff)
downloadgovuk-mini-environment-admin-97f6d7e326a1fd7ddcbe7cf32dc0e4c0a508913d.tar
govuk-mini-environment-admin-97f6d7e326a1fd7ddcbe7cf32dc0e4c0a508913d.tar.gz
Add terraform backend and initial guix configuration
Diffstat (limited to 'app/jobs')
-rw-r--r--app/jobs/setup_job.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/jobs/setup_job.rb b/app/jobs/setup_job.rb
index c7b1b80..6b4f9fe 100644
--- a/app/jobs/setup_job.rb
+++ b/app/jobs/setup_job.rb
@@ -1,5 +1,24 @@
+require 'ruby_terraform'
+
class SetupJob < TerraformJob
def run_terraform
puts "Setting up #{@mini_environment.name}"
+
+ RubyTerraform.init(
+ source: 'terraform/aws',
+ path: 'terraform/aws',
+ backend: true,
+ backend_config: {
+ address: 'http://localhost:3000' + Rails.application.routes.url_helpers.terraform_http_backend_path
+ }
+ )
+
+ RubyTerraform.apply(
+ directory: 'terraform/aws',
+ vars: {
+ slug: @mini_environment.name.parameterize
+ },
+ auto_approve: true
+ )
end
end