Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tags for digital ocean droplets keep changing order #9099

Closed
simaofreitas opened this issue Sep 28, 2016 · 3 comments
Closed

Tags for digital ocean droplets keep changing order #9099

simaofreitas opened this issue Sep 28, 2016 · 3 comments

Comments

@simaofreitas
Copy link

Hi,

I'm using terraform for managing a set of droplets in digital ocean.
Yesterday I introduced tags (using digitalocean_tag) and everything is working correctly.
The problem is that every time I run terraform plan (or apply) I get changes because the tags keep changing their order inside the tfstate file.

Terraform version: 0.7.3

Example of tags definition:

resource "digitalocean_tag" "staging" {
    name = "staging"
}

resource "digitalocean_tag" "web" {
    name = "web"
}

Example of droplet definition

resource "digitalocean_droplet" "machine01" {
  image              = "ubuntu-14-04-x64"
  name               = "machine01"
  region             = "fra1"
  size               = "16gb"
  private_networking = true
  backups            = true
  tags               = ["${digitalocean_tag.staging.id}", "${digitalocean_tag.web.id}"]

  ssh_keys = [
     ...
  ]
}

When running terraform plan (after I already ran terraform apply) I get this:

~ digitalocean_droplet.machine01
    tags.0: "staging" => "web"
    tags.1: "web" => "staging"

If I apply, the next time I run plan I would get the reverse output. But it always changes.

Couldn't find any open issues about this.

Any ideas?

Thanks a lot

@mrjcleaver
Copy link

Perhaps something like this for vSphere can be an inspiration: #6520

@nmarley
Copy link

nmarley commented Apr 25, 2017

This is a real issue, and I think could be solved (maybe?) by sorting the tags received from DO. An even bigger issue is that it also randomly orders SSH keys if you specify multiple, which results in a droplet being destroyed & re-created for no reason other than sort order.

edit: A workaround that I'm planning is to just use one SSH key and then use Ansible or userdata on the host to add them manually, without modifying the DO metadata. Tags I can live without for now, or hack to only have one tag which can be parsed into multiple values.

@ghost
Copy link

ghost commented Apr 10, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants