Closed rmkbow closed 5 years ago
pause for now, seems to throw errors if the user defined list of maps contains variables: example:
locals {
log_publishing_options = [
{
cloudwatch_log_group_arn = "arn:aws:logs:${var.region}:${local.account_id}:log-group:/aws/aes/domains/${var.service}-${var.cluster}-${local.short_stage}"
log_type = "INDEX_SLOW_LOGS"
},
{
cloudwatch_log_group_arn = "arn:aws:logs:${var.region}:${local.account_id}:log-group:/aws/aes/domains/${var.service}-${var.cluster}-${local.short_stage}"
log_type = "ES_APPLICATION_LOGS"
},
{
cloudwatch_log_group_arn = "arn:aws:logs:${var.region}:${local.account_id}:log-group:/aws/aes/domains/${var.service}-${var.cluster}-${local.short_stage}"
log_type = "SEARCH_SLOW_LOGS"
}
]
}
Error: module.elasticsearch.aws_elasticsearch_domain.es: "log_publishing_options.0.cloudwatch_log_group_arn": required field is not set
Error: module.elasticsearch.aws_elasticsearch_domain.es: "log_publishing_options.0.log_type": required field is not set
Error: module.elasticsearch.aws_elasticsearch_domain.es_vpc: "log_publishing_options.0.cloudwatch_log_group_arn": required field is not set
Error: module.elasticsearch.aws_elasticsearch_domain.es_vpc: "log_publishing_options.0.log_type": required field is not set
whereas if the ARN is strictly text then it succeeds
Thanks @rmkbow for this PR.
This feature is available in v0.7.0 which has been just released.
As you've noted there is no way to use computed values in maps, so cloudwatch_log_group_arn
has to be known and specified. There is no easy workaround in Terraform 0.11.
https://github.com/terraform-community-modules/tf_aws_elasticsearch/issues/20
but conflicts with https://github.com/terraform-community-modules/tf_aws_elasticsearch/pull/15/files as we're both trying to implement the same thing
whichever makes more sense design/compatibility wise