Skip to content

ignore lifecycle doesnt work for read and write capacities of GSI #140

@sirisrin

Description

@sirisrin

Describe the Bug

Hi, I created a sample table with GSI and I changed the index read and write capacities from AWS console lets say from 1 to 5 units. and when i run terraform plan it shows in-place updates for GSI,

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place

Terraform will perform the following actions:

module.dynamodb.aws_dynamodb_table.default[0] will be updated in-place

~ resource "aws_dynamodb_table" "default" {
id = "eg-dev-cluster"
name = "eg-dev-cluster"
tags = {
"Name" = "eg-dev-cluster"
"Namespace" = "eg"
"Stage" = "dev"
}
# (10 unchanged attributes hidden)

  - global_secondary_index {
      - hash_key           = "DailyAverage" -> null
      - name               = "DailyAverageIndex" -> null
      - non_key_attributes = [
          - "HashKey",
          - "RangeKey",
        ] -> null
      - projection_type    = "INCLUDE" -> null
      - range_key          = "HighWater" -> null
      - read_capacity      = 5 -> null
      - write_capacity     = 5 -> null
    }
  + global_secondary_index {
      + hash_key           = "DailyAverage"
      + name               = "DailyAverageIndex"
      + non_key_attributes = [
          + "HashKey",
          + "RangeKey",
        ]
      + projection_type    = "INCLUDE"
      + range_key          = "HighWater"
      + read_capacity      = 1
      + write_capacity     = 1
    }

    # (10 unchanged blocks hidden)
}

Plan: 0 to add, 1 to change, 0 to destroy.

Expected Behavior

i mean it should ignore any manual changes for read and write capacities from AWS

Steps to Reproduce

module "dynamodb" {
source = "cloudposse/dynamodb/aws"
version = "0.37.0"
namespace = "eg"
stage = "dev"
name = "cluster"
hash_key = "HashKey"
range_key = "RangeKey"
autoscale_write_target = 70
autoscale_read_target = 70
autoscale_min_read_capacity = 1
autoscale_max_read_capacity = 5
autoscale_min_write_capacity = 1
autoscale_max_write_capacity = 5
enable_autoscaler = false

dynamodb_attributes = [
{
name = "DailyAverage"
type = "N"
},
{
name = "HighWater"
type = "N"
},
{
name = "Timestamp"
type = "S"
}
]

local_secondary_index_map = [
{
name = "TimestampSortIndex"
range_key = "Timestamp"
projection_type = "INCLUDE"
non_key_attributes = ["HashKey", "RangeKey"]
},
{
name = "HighWaterIndex"
range_key = "Timestamp"
projection_type = "INCLUDE"
non_key_attributes = ["HashKey", "RangeKey"]
}
]

global_secondary_index_map = [
{
name = "DailyAverageIndex"
hash_key = "DailyAverage"
range_key = "HighWater"
write_capacity = 1
read_capacity = 1
projection_type = "INCLUDE"
non_key_attributes = ["HashKey", "RangeKey"]
}
]
}

Screenshots

No response

Environment

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🐛 An issue with the system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions