You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
resource "aws_instance" "mongo-cfg01.${var.env_name}.${var.domain_name}" {
ami = "${var.ami_id}"
instance_type = "m1.small"
tags {
Name = "mongo-cfg01.${var.env_name}.${var.domain_name}"
}
}
Douglass-MacBook-Pro:terraform doug$ terraform plan -var-file dev.tfvars
There are warnings and/or errors related to your configuration. Please
fix these before continuing.
Warnings:
* aws_instance.mongo-cfg01.${var.env_name}.${var.domain_name}: module name can only contain letters, numbers, dashes, and underscores.
This will be an error in Terraform 0.4
Seems I can't use programmatic resource names. We've mapped environments (qa, dev, prod etc) to domain names, e.g.: mongo-cfg01.prod.foobar.com, mongo-cfg01.qa.foobar.com and so on. This means we'd have to have one file per environment, which does not scale.
The names in Terraform are just logical for the purposes of referring to them. You want to parameterize the values inside the resource, and not the name itself, so this is by design.
Multiple environments are supported by using different variable and state files.
Reacted by Ivan Montiel, David Calhoun, John Kriter, hangedman, Shashwat Tripathi, asztal and Michael Dunton
Reacted by James Light, Meher, Andrés Bravo, Jesse Nayak, Dao Che, amy null, danybenjamin-tc, Yahor Ivanou, Julian, Andreas Berger and 29 more
Reacted by James Light, Meher, naveenb29, amy null, danybenjamin-tc, Artem Kryvyi, Rakesh Balusa, Panagiotis Atmatzidis, Roman Belyakovsky, Julian and 27 more
Hi! After I've started using modules, this is a problem once again.
For google_dns_record_setmanaged_zone argument is required.
So after defining zone as module, I cant reference it in records for different zones.
The design itself has a flaw if you cannot parametrize it.
Reacted by Terence Doets, Michael Lawler, Sebastian Poxhofer, Chris Powers, Denis Blanchette, Dennis Kao, michaeljeffrey, Basi, Michuelnik, Dimitris Moraitidis and 17 more
Reacted by jestinannapaul, Aaron DeAngelis, Manish Parmar, Rodrigo Moreira de Morais, John Bergant, ismail simsek, beejee, Stefano Stella, Anderson Carubelli, Pietro De Nicolao and 13 more
ghost locked and limited conversation to collaborators on Aug 13, 2019
Activity
armon commentedon Nov 18, 2014
The names in Terraform are just logical for the purposes of referring to them. You want to parameterize the values inside the resource, and not the name itself, so this is by design.
Multiple environments are supported by using different variable and state files.
dgarstang commentedon Nov 19, 2014
Not a bug.
yellowmegaman commentedon Sep 7, 2018
Hi! After I've started using modules, this is a problem once again.
For
google_dns_record_setmanaged_zone argument is required.So after defining zone as module, I cant reference it in records for different zones.
modules/dns-zone/main.tf
dns.tf
records.tf
So, basically all my zones will have
dns-zonename.Maybe modules approach is not the best for zones/records? Or maybe zones as modules should be named.
ameyaagashe commentedon Feb 18, 2019
The design itself has a flaw if you cannot parametrize it.
dimisjim commentedon Apr 10, 2019
This should be reopened...