我在TerraformTerraform DynamoDB指數環
resource "aws_dynamodb_table" "scanner" {
name = "scanner"
read_capacity = 2
write_capacity = 1
hash_key = "public_ip"
attribute {
name = "public_ip"
type = "S"
}
attribute {
name = "region"
type = "S"
}
attribute {
name = "account_id"
type = "N"
}
global_secondary_index {
name = "cleanup-index"
hash_key = "account_id"
range_key = "region"
read_capacity = 1
write_capacity = 1
projection_type = "INCLUDE"
non_key_attributes = ["vpc_id", "instance_id", "integration_id", "private_ip"]
}
}
以下配置它完美,直到我已經升級,從Terraform 0.7.13至0.9.6。此後,Terraform嘗試重新創建索引每次:
~ aws_dynamodb_table.scanner
global_secondary_index.3508752412.hash_key: "" => "account_id"
global_secondary_index.3508752412.name: "" => "cleanup-index"
global_secondary_index.3508752412.non_key_attributes.#: "0" => "4"
global_secondary_index.3508752412.non_key_attributes.0: "" => "vpc_id"
global_secondary_index.3508752412.non_key_attributes.1: "" => "instance_id"
global_secondary_index.3508752412.non_key_attributes.2: "" => "integration_id"
global_secondary_index.3508752412.non_key_attributes.3: "" => "private_ip"
global_secondary_index.3508752412.projection_type: "" => "INCLUDE"
global_secondary_index.3508752412.range_key: "" => "region"
global_secondary_index.3508752412.read_capacity: "" => "1"
global_secondary_index.3508752412.write_capacity: "" => "1"
global_secondary_index.3860163270.hash_key: "account_id" => ""
global_secondary_index.3860163270.name: "cleanup-index" => ""
global_secondary_index.3860163270.non_key_attributes.#: "4" => "0"
global_secondary_index.3860163270.non_key_attributes.0: "vpc_id" => ""
global_secondary_index.3860163270.non_key_attributes.1: "instance_id" => ""
global_secondary_index.3860163270.non_key_attributes.2: "private_ip" => ""
global_secondary_index.3860163270.non_key_attributes.3: "integration_id" => ""
global_secondary_index.3860163270.projection_type: "INCLUDE" => ""
global_secondary_index.3860163270.range_key: "region" => ""
global_secondary_index.3860163270.read_capacity: "1" => "0"
global_secondary_index.3860163270.write_capacity: "1" => "0"
Terraform在他們的DOC說:的DynamoDB API預計屬性結構(名稱和類型)創建或更新GSI/LSI的時候一起傳遞或創建初始表。在這些情況下,它期望提供哈希/範圍鍵;因爲這些地方會在許多地方被重複使用(即表格的範圍鍵可以是一個或多個GSI的一部分),它們被存儲在表格對象上以防止重複並增加一致性。如果您在這裏添加未在這些場景中使用的屬性,則可能會導致規劃中出現無限循環。但我不認爲我的配置與此相關。任何類似的經歷?我懷疑與this有關係。謝謝!