cloudposse / terraform-null-label

Terraform Module to define a consistent naming convention by (namespace, stage, name, [attributes])
https://cloudposse.com/accelerate
Apache License 2.0
635 stars 317 forks source link

Enforce required fields #135

Open nitrocode opened 2 years ago

nitrocode commented 2 years ago

Have a question? Please checkout our Slack Community or visit our Slack Archive.

Slack Community

Describe the Feature

It would be nice to enforce a required field. Sometimes we omit the name field because we're going through a transition where we are moving name from default.auto.tfvars to a yaml catalog and sometimes this field is omitted by mistake.

By enforcing required fields on the null label we can ensure that expected fields are always in place e.g. so we do not have a case where we accidentally create a resource such as an IAM role with a missing name.

Expected Behavior

Use something like required_fields = ["tenant", "namespace", "environment", "name"] for example and if any of those fields are missing, throw an error.

This would also remove the need to use required_tags from introspection.mixin.tf