We have updated our TF version to the 0.13.4 one and now when we try to add a domain that we have purchased that starts with Numbers “007example.com” it will not pass terraform init as it will throw out:
A name must start with a letter or underscore and may contain only letters,
digits, underscores, and dashes.
This is not good as we do have pre-existing domains that are using numbers as starters and future ones some of them might require to user numbers:
Is there a way to escape that and the domain to be successfully added via terraform instead of manually adding and even old ones modifying, as our other resources and modules do not start with numbers only some domains.
This is unfortunately one of the steps where the Terraform v0.12 upgrade guide recommended changing it prior to upgrading, so that you’d be able to more easily use the tools in Terraform v0.11 to handle fixing the invalid module name. It was a bug that Terraform v0.11 and earlier allowed a name starting with a digit, and we needed to fix that bug in v0.12 in order to make other improvements to the language work correctly.
Since you saw this error during terraform init, hopefully you’ve not yet run terraform apply with Terraform v0.12 or later and so you can still return back to Terraform v0.11 and run through the documented upgrade steps.
One of those steps will be to rename your module in configuration to not start with a digit and then use terraform state mv to change the state to match it, so that Terraform won’t think you are trying to destroy the old module and create a new one in its place. But I’d strongly suggest running through the entire upgrade guide as documented because it might find other things that would be easier to deal with before you upgrade, and it will also allow you to automatically update your configuration to use the idiomatic syntax for Terraform v0.12 and later.
Thank you for your detailed reply. Unfortunately I wasn’t aware of the change and as mentioned I am already on a 0.13.4 version, as this issue didn’t popup before the upgrade towards 0.13.4 was made.
With the above said I am not sure how exactly “rename your module” would work, as in this case the module is an already purchased domain, this means that it cannot be altered or its values and itself won’t be working or be added. It’s one thing to rename a network, cluster, owasp and etc, but you cannot rename a “domain” or at least nothing comes to mind that can do the magic right now without altering it’s name.
From your answer I am discourage that there is a workaround solution to my case as I said since most likely in the future there will be another domain/domains that will start with numbers.