When you have created a upcloud_tag
resource with a given name, and have more than one environment (say stage
and prod
) you might want to re-use the same tags that is created for one env on the other env too.
Example:
I tag my servers which runs Ubuntu with ubuntu
and 1604lts
. I want both the machines in the production and staging environment to use the same tags, but my production and staging envs does not share the terraform state files.
So when first creating a tag for the production servers:
resource upcloud_tag {
name = "ubuntu"
servers = ["id", "id2"]
}
And then move on to my stage:
resource upcloud_tag {
name = "ubuntu"
servers = ["id3", "id4"]
}
terraform fails.
Not too strange really, the resource exists with its given name and a set of servers already, but I would love to merge them.
I think a way of fixing this would be to add a property to the Tag schema, say merge = true/false
, and if it's set to true, the provider will first fetch the current server list, then merge the lists and use that list as the actual resource. That way the tag resource is updated with all the servers.
Would this be a wanted feature? I will gladly take a hit on fixing it, but wouldn't want to do it if it's not something that is wanted!