- Assume a terraform script, where it has instance and volume created.
- After a day or two, from portal we have deleted a volume.
- After a week, from terraform I would like to update the tags, instance type of that vm.
So above 3rd step should not recreate any volume or should not delete any existing tags attached to vm
For those cases you can use
ignore_changesand provide a list of anything you want to ignore when changed after created... Most people will advise against this and I agree, you should use this ignore as a last resource, your infrastructure changes should be ALL in terraform not manually in the portal or any other way, mixing manual changes with terraform is a recipe for disasterFor the tags see what your options is
tags["tag_name"]what you are asking "not delete any existing tags" you will have to specify what tags you want to ignore, I have not seen any option for wildcards there, there are requests for it:but not much traction there
Another way to ignore tags globally is using the
ignore_tagsConfiguration Block on the AWS provider, you have a bit more flexible option there if it applies to multiple resourceshttps://registry.terraform.io/providers/hashicorp/aws/latest/docs#ignore_tags-configuration-block