diff --git a/go.mod b/go.mod index 46239743..1d688a03 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/masterzen/winrm v0.0.0-20200615185753-c42b5136ff88 // indirect github.com/mitchellh/gox v1.0.1 // indirect github.com/packer-community/winrmcp v0.0.0-20180921211025-c76d91c1e7db // indirect - github.com/sebdah/goldie/v2 v2.5.3 // indirect + github.com/sebdah/goldie/v2 v2.5.3 github.com/stretchr/testify v1.6.1 github.com/teris-io/shortid v0.0.0-20171029131806-771a37caa5cf github.com/tombuildsstuff/giovanni v0.12.0 // indirect @@ -35,7 +35,7 @@ require ( golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb // indirect google.golang.org/api v0.34.0 // indirect - gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61 // indirect + gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61 k8s.io/api v0.20.5 k8s.io/apimachinery v0.20.5 k8s.io/client-go v0.20.5 diff --git a/iterative/resource_runner.go b/iterative/resource_runner.go index 956bd8d2..b7b2c8bc 100644 --- a/iterative/resource_runner.go +++ b/iterative/resource_runner.go @@ -338,8 +338,15 @@ sudo bash -c 'cat << EOF > /etc/systemd/system/cml.service WantedBy=multi-user.target EOF' +{{if .cloud}} +{{if eq .cloud "azure"}} sudo systemctl enable cml.service sudo reboot +{{- else}} +sudo systemctl daemon-reload +sudo systemctl enable cml.service --now +{{- end}} +{{- end}} {{- end}} `) var customDataBuffer bytes.Buffer diff --git a/iterative/resource_runner_test.go b/iterative/resource_runner_test.go index f984c63b..466f62b3 100644 --- a/iterative/resource_runner_test.go +++ b/iterative/resource_runner_test.go @@ -2,11 +2,12 @@ package iterative import ( "encoding/base64" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/sebdah/goldie/v2" "os" "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/sebdah/goldie/v2" + "github.com/stretchr/testify/assert" ) diff --git a/iterative/testdata/script_template_cloud_aws.golden b/iterative/testdata/script_template_cloud_aws.golden index 56f7147f..16d7a023 100644 --- a/iterative/testdata/script_template_cloud_aws.golden +++ b/iterative/testdata/script_template_cloud_aws.golden @@ -78,5 +78,7 @@ sudo bash -c 'cat << EOF > /etc/systemd/system/cml.service WantedBy=multi-user.target EOF' -sudo systemctl enable cml.service -sudo reboot + + +sudo systemctl daemon-reload +sudo systemctl enable cml.service --now diff --git a/iterative/testdata/script_template_cloud_azure.golden b/iterative/testdata/script_template_cloud_azure.golden index 6c848260..d7b60f84 100644 --- a/iterative/testdata/script_template_cloud_azure.golden +++ b/iterative/testdata/script_template_cloud_azure.golden @@ -79,5 +79,7 @@ sudo bash -c 'cat << EOF > /etc/systemd/system/cml.service WantedBy=multi-user.target EOF' + + sudo systemctl enable cml.service sudo reboot diff --git a/iterative/testdata/script_template_cloud_invalid.golden b/iterative/testdata/script_template_cloud_invalid.golden index ccb212d6..8c87a2fc 100644 --- a/iterative/testdata/script_template_cloud_invalid.golden +++ b/iterative/testdata/script_template_cloud_invalid.golden @@ -74,5 +74,7 @@ sudo bash -c 'cat << EOF > /etc/systemd/system/cml.service WantedBy=multi-user.target EOF' -sudo systemctl enable cml.service -sudo reboot + + +sudo systemctl daemon-reload +sudo systemctl enable cml.service --now