Closed oveits closed 8 years ago
As I thought: If I define
variable "aws_ami_master" {default = "${lookup(var.centos7-images, var.region)}" }
I get the error
Variable 'aws_ami_master': cannot contain interpolations
Now trying by skipping the intermediate step and directly defining:
resource "aws_instance" "ose-master" {
ami = "${lookup(var.centos7-images, var.aws_region)}"
...
}
This seems to work...
This enhancement is now moved to https://github.com/oveits/openshift-terraform-ansible/issues/1
Today we are using static AMI images:
However, ami IDs are region specific. Therefore this works in eu-central-1 only.
Instead of a static value, I would like to use a map like follows (list found on https://gist.github.com/gene1wood/a00d0b9d029f40e866df):
or
as I have found 'hostname = "${lookup(var.hostnames, count.index)}"' on the terraform interpolation documentation page
And then:
However, it might be that such an interpolation of the aws_ami_master variable is not possible. In this case, we could try using the map directly:
drawback: if we change the region, we still need to change the file... I need to test interpolation in more detail...