terraform-provider-scaleway icon indicating copy to clipboard operation
terraform-provider-scaleway copied to clipboard

scaleway_instance_server cloud_init updates

Open p3root opened this issue 3 years ago • 2 comments

If I update the cloud init script - the virtual machine will be deleted and recreated. This behaviour is sometimes not wanted.

I would suggest to update the cloud_init block with the wanted behaviour.

Is:

resource "scaleway_instance_server" "server" {
  cloud_init  = var.cloud_init
}

Suggestion:

resource "scaleway_instance_server" "server" {
  cloud_init  {
       script = var.cloud_init
       update_behaviour = "ignore" // ignore, update, throw
  }
}

I suggest the following options:

  • Ignore Will do nothing
  • Update Same behaviour as right now
  • Throw Throws an error inside the plan/validate phase

I could help with the impl itself - but wanted to ask initialy ;)

Cheers, Patrik

p3root avatar Jun 04 '21 20:06 p3root

Actually if I update the cloud-init script (which is in user_data, not in the root as your code snippet), that does nothing.

And I would like the resource to be recreated.

How did you manage to get the resource recreated?

boomaker avatar Aug 09 '21 10:08 boomaker

Actually if I update the cloud-init script (which is in user_data, not in the root as your code snippet), that does nothing.

And I would like the resource to be recreated.

How did you manage to get the resource recreated?

I guess it is because @p3root is using images given by Scaleway (like image = "ubuntu_focal") ? The behavior is different than using a custom image.

clement-dv-wdz avatar Sep 25 '21 18:09 clement-dv-wdz

This should be handled with our new resource resource_instance_user_data. Please our documentation here

Monitob avatar Oct 06 '22 12:10 Monitob