Comments (8)
I'm trying to use sort()
with a list of tags but it has o effect:
locals = {
tags = ["${var.stage}", "${var.group}", "${var.env}"]
tags_sorted = "${sort(distinct(local.tags))}"
tags_count = "${length(local.tags_sorted)}"
}
resource "digitalocean_tag" "host" {
name = "${element(local.tags_sorted, count.index)}"
count = "${local.tags_count}"
}
resource "digitalocean_droplet" "host" {
...
tags = ["${sort(digitalocean_tag.host.*.id)}"]
...
}
The result is still the same, tags re-ordering on every run.
from terraform-provider-digitalocean.
Same issue here.
- "tags.0": "worker",
- "tags.1": "cluster",
+ "tags.0": "cluster",
+ "tags.1": "worker",
from terraform-provider-digitalocean.
Same issue.
Use sort() is a workaround
from terraform-provider-digitalocean.
This still seems to be an issue, @jackivanov can you elaborate and give an example?
from terraform-provider-digitalocean.
this worked for me
module "do_swarm_worker" {
source = "./do_swarm_worker"
token = "${var.do_token}"
region = "${var.do_region}"
domain = "${var.domain}"
tags = ["${sort(list(digitalocean_tag.cluster.id,digitalocean_tag.worker.id))}"]
}
from terraform-provider-digitalocean.
Very annoying issue
from terraform-provider-digitalocean.
Hello fellow DigitalOcean Terraformers! I've joined the group of people suffering from the issue. No sort work-arounds are working for me. I've recently also hit a hard limit of DigitalOcean firewalls (100), what caused me to start heavily rely on tags. So now for each TF workspace, we do get a plan with changes, even tho there are not real changes :(
Considering that we are kind of forced to use tags if we want to utilise digitalocean_firewall effectively, I think this issue is more than annoying. Any known work-arounds are welcome!
Side question - did anyone try to sort the problem with lifecycle & ignore_changes? I haven't explored it yet as it feels like dirty hack - I still kind of care about changes to tags (if there are actual changes)
from terraform-provider-digitalocean.
@paranoidd It totally depends on your implementation/requirements/needs. For example, you can do it like in this demo https://github.com/baffolobill/terraform-digitalocean-tags-hack (this is part of my project, not sure that all dependencies included) - I just manually process tags via bash scripts. This is just an idea, not complete solution.
resource "null_resource" "assign_tags_to_droplet" {
depends_on = [
"digitalocean_droplet.bastion",
"module.droplet_tags",
]
count = "${var.num_nodes}"
triggers {
tag_ids = "${join(",", module.droplet_tags.tags)}",
droplet_id = "${element(digitalocean_droplet.bastion.*.id, count.index)}",
}
# !!! All magic does this script. You can test it like so:
provisioner "local-exec" {
command = "\"${path.module}/../../../../scripts/assign_tags_to_droplet.sh\" ${element(digitalocean_droplet.bastion.*.id, count.index)} ${join(" ", module.droplet_tags.tags)}"
}
}
I do so because of another problem with tags: in some cases when Terraform sees changes in tags, it destroys a tag by deleting it (contrary to "untag") (if it's not obvious, Terraform doesn't re-add resources to a tag, when it re-creates a tag). As result, this tag disappear from all resources, even from those which aren't managed by Terraform. It brings me to situation when Droplets didn't see each other (my firewall rules totally rely on tags), consul couldn't connect to leader (because auto-join rely on tags).
from terraform-provider-digitalocean.
Related Issues (20)
- App Platform image credentials set as required HOT 3
- Dedicated egress IP addresses support for App platform
- digitalocean_spaces_bucket NoSuchBucket while creating bucket HOT 3
- digitalocean_kubernetes_cluster. to support database operator HOT 2
- Consider adding GPG key to OpenTofu registry for the digitalocean provider HOT 2
- Support for database fork
- digitalocean_firewall blocks all ports
- digitalocean_ssh_key race condition (roduced an unexpected new value: Root object was present, but now absent) HOT 1
- digitalocean_database_cluster password is always empty HOT 5
- functions: feature: add resource, and data source for functions and namespaces
- Add OpenSearch Documentation HOT 1
- digitalocean_app panic HOT 1
- digitalocean_app: support private docker repositories HOT 2
- digitalocean_app: Service Autoscaling
- Error creating droplet: JSON unmarshal issue with large number into Go struct field type int HOT 2
- Imported database replica attempting to resize to current configuration HOT 1
- digitalocean_app.alert does not support DEPLOYMENT_STARTED and DEPLOYMENT_CANCELLED
- Certificate not found on import of digitalocean_certificate HOT 2
- `DEPLOYMENT_STARTED` and `DEPLOYMENT_CANCELLED` missing from docs
- Databases: Support Logsink
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-digitalocean.