IBM-Cloud / terraform

Terraform is a tool for building, changing, and combining infrastructure safely and efficiently.
http://www.terraform.io
Mozilla Public License 2.0
11 stars 8 forks source link

provider/softlayer: Implement softlayer_provisioning_hook Resource #84

Closed danielcbright closed 7 years ago

danielcbright commented 8 years ago

Implement Resource: softlayer_provisioning_hook

This issue will track the completion of the _provisioninghook resource type requirement for the SoftLayer Provisioner.

Tracking Checklist

Example configuration:

resource softlayer_provisioning_hook "test_provisioning_hook" {
    name = "srinivas-hook-july21"
    uri = "https://raw.githubusercontent.com/srinivas-dandibhotla/slvm/master/apt-vm-init-vim.sh"
}
renier commented 8 years ago

We are also going to need to modify virtual_guest to accept a provisioning hook label as a parameter.

riethm commented 8 years ago

After some discussion, we no longer feel that adding a 'provisioning_hook_label' field to the virtual_guest resource adds sufficient value to offset the complexity in doing so.

Some factors that weigh into this thinking:

  1. SoftLayer does not maintain the relationship between provisioning hook 'object' and virtual guest, so there is no way to read the information back during a refresh, or an update to an existing state.
  2. Updating the provisioning hook directly in SoftLayer could result in ambiguous behavior relative to the user's expectation. E.g., Upon modifying the URI of a provisioning hook, or deleting it entirely from SoftLayer, what action(s) should be taken on virtual_guest resources that previously referenced that provisioning hook?
  3. There are existing trivial alternatives for passing a common URI to a virtual_guest resource
    1. Terraform variables
    2. Interpolation of the URI variable from a provisioning_hook resource defined within the same configuration, e.g.,:
resource "softlayer_provisioning_hook" "my_hook" {
    name = "mike_custom_script"
    uri = "https://something"
}

resource "softlayer_virtual_guest" "guest1" {
    …
    post_install_script_uri = "${softlayer_provisioning_hook.my_hook.uri}"
    …
}