I have a table definition in one file. The table definition contains multiple secondary indexes definitions:
resource "aws_dynamodb_table" "recalculation_rules" {
hash_key = "code"
name = "TC-RecalculationRules-${terraform.workspace}"
read_capacity = 2
write_capacity = 2
attribute {
name = "code"
type = "S"
}
attribute {
name = "nameHash"
type = "S"
}
attribute {
name = "pricesHash"
type = "S"
}
global_secondary_index {
hash_key = "nameHash"
name = "RuleNameHashIndex"
projection_type = "ALL"
write_capacity = 2
read_capacity = 2
}
global_secondary_index {
hash_key = "pricesHash"
name = "RulePricesHashIndex"
projection_type = "ALL"
write_capacity = 2
read_capacity = 2
}
}
In another file, I want to make a reference to these global secondary indexes names:
output "tc_recalculation_rules_table_global_secondary_by_name_index_name" {
value = aws_dynamodb_table.recalculation_rules.global_secondary_index[0].name
}
output "tc_recalculation_rules_table_global_secondary_by_prices_index_name" {
value = aws_dynamodb_table.recalculation_rules.global_secondary_index[1].name
}
However, it does not work for me:
in output "tc_recalculation_rules_table_global_secondary_by_prices_index_name":
38: value = aws_dynamodb_table.recalculation_rules.global_secondary_index[1].name
Could you please help - how can I can refer to these indexes names in this case?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…