fpco / terraform-aws-foundation

Establish a solid Foundation on AWS with these modules for Terraform
MIT License
204 stars 98 forks source link

Fix errors visible from make plan in the tests directory #279

Closed qrilka closed 4 years ago

qrilka commented 4 years ago

This mostly fixes errors introduced by #247 and also type errors (which probably appeared when we migrated to TF 0.12)

qrilka commented 4 years ago

Actually this looks to be a partial fix, make plan shows some errors still:

Error log ``` Error: Invalid operand on ../modules/elasticsearch/data-nodes.tf line 157, in data "template_file" "data-node-config": 157: ${element(split(".", var.elasticsearch_version), 0) < 6 ? "cloud.aws.region: ${data.aws_region.current.name}" : ""} |---------------- | var.elasticsearch_version is "" Unsuitable value for left operand: a number is required. Error: Invalid operand on ../modules/elasticsearch/master-nodes.tf line 144, in data "template_file" "master-node-config": 144: ${element(split(".", var.elasticsearch_version), 0) < 6 ? "cloud.aws.region: ${data.aws_region.current.name}" : ""} |---------------- | var.elasticsearch_version is "" Unsuitable value for left operand: a number is required. Error: Invalid index on ../modules/elasticsearch/outputs.tf line 33, in output "internal_lb": 33: "security_group_id" = var.internal_alb["security_group_id"] |---------------- | var.internal_alb is empty map of string The given key does not identify an element in this collection value. Error: Invalid index on ../modules/elasticsearch/outputs.tf line 33, in output "internal_lb": 33: "security_group_id" = var.internal_alb["security_group_id"] |---------------- | var.internal_alb is empty map of string The given key does not identify an element in this collection value. Error: failed to render : :3,17-38: Unknown variable; There is no variable named "bootstrap_pillar_file". on ../modules/init-snippet-consul-leader/main.tf line 13, in data "template_file" "init_snippet": 13: data "template_file" "init_snippet" { Error: failed to render : :67,44-53: Invalid template control keyword; "http_code" is not a valid template control keyword. on ../modules/kibana/main.tf line 51, in data "template_file" "kibana-setup": 51: data "template_file" "kibana-setup" { Error: Invalid index on ../modules/kibana/outputs.tf line 44, in output "lb": 44: "security_group_id" = var.alb["security_group_id"] |---------------- | var.alb is empty map of string The given key does not identify an element in this collection value. Error: Invalid index on ../modules/kibana/outputs.tf line 44, in output "lb": 44: "security_group_id" = var.alb["security_group_id"] |---------------- | var.alb is empty map of string The given key does not identify an element in this collection value. Error: failed to render : :62,26-27: Invalid character; This character is not used within the language., and 2 other diagnostic(s) on ../modules/logstash/main.tf line 62, in data "template_file" "logstash-config": 62: data "template_file" "logstash-config" { Error: multiple subnets matched; use additional constraints to reduce matches to a single subnet on ../modules/prometheus-server/main.tf line 22, in data "aws_subnet" "server-subnet": 22: data "aws_subnet" "server-subnet" { Error: multiple subnets matched; use additional constraints to reduce matches to a single subnet on ../modules/single-node-asg/main.tf line 15, in data "aws_subnet" "server-subnet": 15: data "aws_subnet" "server-subnet" { Error: multiple subnets matched; use additional constraints to reduce matches to a single subnet on ../modules/single-node-asg/main.tf line 15, in data "aws_subnet" "server-subnet": 15: data "aws_subnet" "server-subnet" { Error: Error in function call on ../modules/web-alb/main.tf line 2, in data "aws_acm_certificate" "web-server-cert": 2: domain = coalesce(var.dns_ssl_name, var.dns_name) |---------------- | var.dns_name is "" | var.dns_ssl_name is "" Call to function "coalesce" failed: no non-null, non-empty-string arguments. ```
qrilka commented 4 years ago

With some additional fixes the list of errors is now:

A bit shorter ``` Error: Invalid index on ../modules/elasticsearch/outputs.tf line 33, in output "internal_lb": 33: "security_group_id" = var.internal_alb["security_group_id"] |---------------- | var.internal_alb is empty map of string The given key does not identify an element in this collection value. Error: Invalid index on ../modules/elasticsearch/outputs.tf line 33, in output "internal_lb": 33: "security_group_id" = var.internal_alb["security_group_id"] |---------------- | var.internal_alb is empty map of string The given key does not identify an element in this collection value. Error: Invalid index on ../modules/kibana/outputs.tf line 44, in output "lb": 44: "security_group_id" = var.alb["security_group_id"] |---------------- | var.alb is empty map of string The given key does not identify an element in this collection value. Error: Invalid index on ../modules/kibana/outputs.tf line 44, in output "lb": 44: "security_group_id" = var.alb["security_group_id"] |---------------- | var.alb is empty map of string The given key does not identify an element in this collection value. Error: multiple subnets matched; use additional constraints to reduce matches to a single subnet on ../modules/prometheus-server/main.tf line 22, in data "aws_subnet" "server-subnet": 22: data "aws_subnet" "server-subnet" { Error: multiple subnets matched; use additional constraints to reduce matches to a single subnet on ../modules/single-node-asg/main.tf line 15, in data "aws_subnet" "server-subnet": 15: data "aws_subnet" "server-subnet" { Error: multiple subnets matched; use additional constraints to reduce matches to a single subnet on ../modules/single-node-asg/main.tf line 15, in data "aws_subnet" "server-subnet": 15: data "aws_subnet" "server-subnet" { Error: No certificate for domain "test-web-alb.net" found in this region on ../modules/web-alb/main.tf line 1, in data "aws_acm_certificate" "web-server-cert": 1: data "aws_acm_certificate" "web-server-cert" { ```

I'm not sure what to do about those...