Comments (4)
Hello @mloskot ,
Thanks for your suggestion!
At Claranet we already handle this with our internal tagging policy and this module: https://github.com/claranet/terraform-claranet-default-tags
I think you may want to create your own module with your needs. Adding theses default tags on every modules we have will requires lots of maintenance.
from terraform-azurerm-rg.
Hi @Shr3ps, although such module is a very neat idea, I have just noticed I missed a very important detail in my suggestion: lifecycle
and ignore_changes
. I meant tags which are created once per a resource lifetime:
resource "azurerm_resource_group" "main" {
name = data.azurecaf_name.main_rg.result
location = module.azure_region.location
tags = {
created_at = timestamp()
created_by = data.azuread_directory_object.terraform.object_id
}
lifecycle {
ignore_changes = [
tags["created_at"],
tags["created_by"],
]
}
AFAIK, there is no way to inject such lifecycle
configuration into resources created by modules. Unless, source code of such modules is modified.
Adding theses default tags on every modules we have will requires lots of maintenance.
Yes, I'm aware this issue may be a blocker here.
from terraform-azurerm-rg.
Hey,
For your tag created_at
(which IMO should be updated_at
instead), no lifecycle ingore_changes is needed if you use a time_static resource (https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/static) instead of the timestamp()
builtin which is evaluated every time.
and for your created_by
, I don't get also why you need to ignore it, best practices would be to use a CD/pipeline to apply terraform stacks, which means using an Identity, a Service Principal or a Service account - that don't change.
from terraform-azurerm-rg.
no lifecycle ingore_changes is needed if you use a time_static resource
I was not aware of this module. Thanks a lot @Shr3ps !
for your created_by, I don't get also why you need to ignore it, best practices would be to use a CD/pipeline to apply terraform stacks, which means using an Identity, a Service Principal or a Service account - that don't change.
Yes, you are right about the pipelines recommendation.
In that particular case, I mixed cases of running terraform plan|apply
by human operator (User account) and CI pipeline (Service Principal). It's an edge case though.
from terraform-azurerm-rg.
Related Issues (2)
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-azurerm-rg.