Closed d1rtym0nk3y closed 3 years ago
Hey Chris, thanks for raising this issue and I agree that tags could be more widely used across many of the resources (currently on the xenorchestra_sr
data source has a tags
attribute).
Your first and second criteria are possible, however, The provider should not attempt to manage tags that have been manually added via XOA
is not possible. It isn't feasible because Terraform won't have any way to distinguish removing a tag from the terraform code from a manually created tag not defined in code.
So I can absolutely implement this support but unfortunately I can't implement ignoring manually added tags.
Having terraform be able to add tags would be a huge win 👍
Re: the provider should not attempt to manage tags that have been manually added via XOA
If I create a vm with tf; lets say with tag:a
and tag:b
. tf will store that in its state. If i then remove tag:b
from my config, and apply the change it knows i've removed tag:b
, so the only action it should take is to ensure that tag:b
is not present in the tags from XOA. At the same time, it should ensure that tag:a
is present. All other tags should be ignored...
I think tf calls this a partial update ?
@d1rtym0nk3y terraform doesn't track state across runs. Meaning Terraform doesn't remember what tags it was initially created with. It only knows what is currently in the configuration and what exists in the XO api.
There is some support for using ignore_changes
with map data types (which tags would be). However, it only works with updates meaning you would need to add a placeholder value in your terraform code to have the ignore applied (see this for an example).
If you have a way to implement it, I'm all ears but from my experience developing more than one terraform provider it's not possible.
That being said I should be able to start some resource support for this soon 👌
My misunderstanding then, I was under the impression tf tracked state between runs. It probably is better to manage tags via tf config anyway
This will be available in the next release (v0.13.0). I'm going to try and get some other features in that release so it won't be available until later this week.
Sorry for the delay but v0.13.0 is now released.
Would be great to be able to specify tags for created vm's (and other objects that support tags)
Desired behaviour