TritonDataCenter / terraform-provider-triton

Terraform Joyent Triton provider
https://www.terraform.io/docs/providers/triton/
Mozilla Public License 2.0
15 stars 24 forks source link

Proposal: Expand on Triton's metadata API #11

Closed jwreagor closed 7 years ago

jwreagor commented 7 years ago

There's an upstream issue in the triton-go API which incorrectly updates metadata at the tags endpoint, causing the provider to create tags instead of metadata pairs. I have a triton-go PR open for addressing this issue as well as opening up the API for other metadata use cases.

Upgrading the vendored library will resolve the incorrect endpoint but I'd also like a metadata stanza itself. In a similar fashion to the tags stanza, Joyent's Triton API allows any map[string]string of JSON to be added/updated during or after an Instance is created. Subsequently, this can be used by internal processing within a live running instance. Terraform should facilitate the same functionality.

Today, this provider only allows a limited subset of metadata functionality, and none of it custom. Configuration like user_data, user_script, cloud_config, and administrator_pw, are made possible through metadata and should not change. Refactoring, however, should allow any metadata changes to occur without rebooting an instance.

Terraform Version

0.10.0+

Affected Resource(s)

Terraform Configuration Files

resource "triton_machine" "base" {
  name = "base${count.index}"
  package = "sample-512M"
  image = "${data.triton_image.base.id}"

  # tags are organizational in nature
  tags {
    version = "1.0.0"
    role = "test"
  }

  # metadata is tied to instance/bootstrap functionality
  user_script = "${file("user_script.txt")}"

  metadata {
    custom_defined = "anything here"
    seed_token = "abcdefg1234"
  }
}

Expected Behavior

Actual Behavior

jwreagor commented 7 years ago

I can take care of this as well, just looking for feedback and thumbs up emojis...

jwreagor commented 7 years ago

Didn't realize but this appears to be a duplicate of #5 so mark this as the proposal.

jwreagor commented 7 years ago

Proposed solution was merged in by #17.