Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: aws_elasticache_serverless_cache: ecpu_per_second without a limit block count changed from 1 to 0. #35660

Closed
maxvisser opened this issue Feb 6, 2024 · 9 comments · Fixed by #35927
Labels
bug Addresses a defect in current functionality. service/elasticache Issues and PRs that pertain to the elasticache service.
Milestone

Comments

@maxvisser
Copy link

Terraform Core Version

1.5.7

AWS Provider Version

5.35.0

Affected Resource(s)

aws_elasticache_serverless_cache

Expected Behavior

Setting ecpu to 0 would mean unlimited

Actual Behavior

Its set it to unlimited but I run into an error after apply

Relevant Error/Panic Output Snippet

│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to aws_elasticache_serverless_cache.nhb-redis-staging-1, provider "provider[\"registry.terraform.io/hashicorp/aws\"]" produced an unexpected new value:
│ .cache_usage_limits[0].ecpu_per_second: block count changed from 1 to 0.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Terraform Configuration Files

resource "aws_elasticache_serverless_cache" "xx-redis-staging-1" {
  engine = "redis"
  name   = "xx-redis-staging-1"
  cache_usage_limits {
    data_storage {
      maximum = 5
      unit    = "GB"
    }
    ecpu_per_second {
      maximum = 0
    }
  }
  daily_snapshot_time      = "09:00"
  description              = "Redis for xx Staging"
  major_engine_version     = "7"
  snapshot_retention_limit = 1
  security_group_ids = [aws_security_group.elasticache_sg.id]
  subnet_ids = ["subnet-xx","subnet-xx", "subnet-xx"]
  user_group_id = aws_elasticache_user_group.nhbGroup.user_group_id
}

Steps to Reproduce

apply a aws_elasticache_serverless_cache resource with
ecpu_per_second {
maximum = 0
}

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@maxvisser maxvisser added the bug Addresses a defect in current functionality. label Feb 6, 2024
Copy link

github-actions bot commented Feb 6, 2024

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@meetreks
Copy link
Contributor

I checked in Console but it does not allow me to put a 0 in Max
This is thee error I am getting on the console

ElastiCache Processing Units (ECPUs) limit is out of range.
You can set a maximum limit between 1,000 and 15,000,000 ECPUs per second.

@mshahmoradi87
Copy link

I checked in Console but it does not allow me to put a 0 in Max This is thee error I am getting on the console

ElastiCache Processing Units (ECPUs) limit is out of range. You can set a maximum limit between 1,000 and 15,000,000 ECPUs per second.

true, but if possible with 0, module should not try to set it, as a workaround I have defined this block like below:

  dynamic "cache_usage_limits" {
    for_each = (var.max_storage_gb >= 1 || var.max_epu_per_second >= 1000) ? [1] : []

    content {
      dynamic "data_storage" {
        for_each = var.max_storage_gb >= 1 ? [1] : []
        content {
          maximum = var.max_storage_gb
          unit    = "GB"
        }
      }

      dynamic "ecpu_per_second" {
        for_each = var.max_epu_per_second >= 1000 ? [1] : []
        content {
          maximum = var.max_epu_per_second
        }
      }
    }
  }

@meetreks
Copy link
Contributor

If you want I can put a validation which will error on Plan stage, is this Ok @mshahmoradi87

@meetreks
Copy link
Contributor

Added limits as mentioned above

@stegosaurus21
Copy link

stegosaurus21 commented Feb 26, 2024

Hi, I am also encountering this issue. According to AWS CLI documentation, setting these values to zero seems to be the intended way to indicate an unlimited resource cap.

In general, there doesn't seem to be a way in the module at the moment to set only a ECPU or data storage limit without setting the other as well.

@github-actions github-actions bot added this to the v5.40.0 milestone Mar 6, 2024
@maxvisser
Copy link
Author

Hi, I am also encountering this issue. According to AWS CLI documentation, setting these values to zero seems to be the intended way to indicate an unlimited resource cap.

In general, there doesn't seem to be a way in the module at the moment to set only a ECPU or data storage limit without setting the other as well.

This was indeed the issue that I was having too. Not sure with the current validation fix how to set it to unlimited..

Copy link

github-actions bot commented Mar 7, 2024

This functionality has been released in v5.40.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

github-actions bot commented Apr 7, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/elasticache Issues and PRs that pertain to the elasticache service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants