Open HartS opened 7 months ago
Note: the reason I highlight waiting on server_status=OK
is because it can be trivially waited on in resource_vultr_instance.go
using the waitForServerAvailable
function defined there. See https://github.com/vultr/terraform-provider-vultr/compare/master...HartS:terraform-provider-vultr:master
Given the extremely long wait time for server_status
to transition to ok
(compared to cloud-init status --wait
which introduces a much more reasonable delay) I suspect this isn't currently the right approach
@HartS Are you able to reproduce the issue when using the terraform provider directly? I just did a quick test that docker was installed after using your script in the userdata like so
resource "vultr_instance" "inst" {
region = "mel"
plan = "vc2-2c-4gb"
label = "tf-ud-test"
os_id = 1743
tags = ["tf"]
user_data = file("~/dump/setup.sh")
}
Where ~/dump/setup.sh
is your script. After which, SSHing in and checking that docker is installed shows:
Can you check the user data from my.vultr.com to verify that the script is there in plaintext?
I'm actually using Pulumi, but https://github.com/dirien/pulumi-vultr appears to be largely generated from the Vultr terraform provider.
I noticed with Ubuntu 22.04 that when I
pulumi up
with auser-data
script that installs docker, the installation is still in progress when the command completes, theserver_status
isinstallingbooting
, and docker is unavailable.To Reproduce
With Pulumi, set the vultr:apiKey and privateKeyFile config, and
pulumi up
with the following Pulumi.yaml:and
setup.sh
(which runs with cloud-init)Expected behavior The
dockerPsOutput
output should contain"CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES"
(the header from runningdocker ps
)Desktop (please complete the following information where applicable:
Additional context
For reference, I added the following resource after
dev
:and modified the
dockerPsOutput
resource:With the above changes, the upgrade now waits for
server_status=OK
, and the next step succeeds (however, it does introduce a ~7.5 minute delay, as the server status takes a while to transition out ofinstallingbooting
... this seems like a separate issue on Vultr's end)Ideally there would be a way to configure the terraform provisioning to have it wait until cloud-init user scripts are finished; as a workaround, a later step can be added that runs
cloud-init status --wait