azurerm_redis_cache - tighten validation for sku_name, family, capacity#29079
Merged
azurerm_redis_cache - tighten validation for sku_name, family, capacity#29079
azurerm_redis_cache - tighten validation for sku_name, family, capacity#29079Conversation
…r-azurerm into wyatt/redis-sku-family-capacity-validation
…r-azurerm into wyatt/redis-sku-family-capacity-validation
katbyte
reviewed
Mar 17, 2025
Comment on lines
+403
to
+410
| capacity := diff.Get("capacity").(int) | ||
| validCombinations := map[string][]string{ | ||
| string(redis.SkuNameBasic): {"C0", "C1", "C2", "C3", "C4", "C5", "C6"}, | ||
| string(redis.SkuNameStandard): {"C0", "C1", "C2", "C3", "C4", "C5", "C6"}, | ||
| string(redis.SkuNamePremium): {"P1", "P2", "P3", "P4", "P5"}, | ||
| } | ||
| familyCapacity := fmt.Sprintf("%s%d", strings.ToUpper(family), capacity) | ||
| if !slices.Contains(validCombinations[skuName], familyCapacity) { |
Collaborator
There was a problem hiding this comment.
whitespace is desirable here
Suggested change
| capacity := diff.Get("capacity").(int) | |
| validCombinations := map[string][]string{ | |
| string(redis.SkuNameBasic): {"C0", "C1", "C2", "C3", "C4", "C5", "C6"}, | |
| string(redis.SkuNameStandard): {"C0", "C1", "C2", "C3", "C4", "C5", "C6"}, | |
| string(redis.SkuNamePremium): {"P1", "P2", "P3", "P4", "P5"}, | |
| } | |
| familyCapacity := fmt.Sprintf("%s%d", strings.ToUpper(family), capacity) | |
| if !slices.Contains(validCombinations[skuName], familyCapacity) { | |
| capacity := diff.Get("capacity").(int) | |
| validCombinations := map[string][]string{ | |
| string(redis.SkuNameBasic): {"C0", "C1", "C2", "C3", "C4", "C5", "C6"}, | |
| string(redis.SkuNameStandard): {"C0", "C1", "C2", "C3", "C4", "C5", "C6"}, | |
| string(redis.SkuNamePremium): {"P1", "P2", "P3", "P4", "P5"}, | |
| } | |
| familyCapacity := fmt.Sprintf("%s%d", strings.ToUpper(family), capacity) | |
| if !slices.Contains(validCombinations[skuName], familyCapacity) { |
Co-authored-by: kt <kt@katbyte.me>
Contributor
Author
|
Here is an example of what the error message looks like: |
Contributor
Author
|
Here's an example if it's limited to the SKU: |
wyattfry
added a commit
that referenced
this pull request
Mar 20, 2025
jackofallops
added a commit
that referenced
this pull request
Mar 21, 2025
* CHANGELOG.md for v4.24.0 * Update CHANGELOG.md #28173 * Update CHANGELOG.md #28964 * Update CHANGELOG.md #28569 * Update CHANGELOG.md for #28670 * Update CHANGELOG.md #29081 * Update CHANGELOG.md for #29082 * Update CHANGELOG.md #28888 * Update CHANGELOG.md #29012 * Update CHANGELOG.md #28485 * Update CHANGELOG.md for #29094 * Update CHANGELOG.md #29107 * Update CHANGELOG.md #28368 * Update for #29113 #28884 #28739 #28920 #29018 #28822 #28977 #29096 #29040 * Update for #29088 * Update CHANGELOG.md #29079 * Update CHANGELOG.md #28992 * prep for release --------- Co-authored-by: sreallymatt <106555974+sreallymatt@users.noreply.github.com> Co-authored-by: Wyatt Fry <wyattfry@gmail.com> Co-authored-by: jackofallops <11830746+jackofallops@users.noreply.github.com> Co-authored-by: Matthew Frahry <mbfrahry@gmail.com> Co-authored-by: stephybun <steph@hashicorp.com> Co-authored-by: jackofallops <ste@hashicorp.com>
Contributor
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Community Note
Description
This PR tightens the validation for the combination of the arguments
sku_name,familyandcapacityto replicate that which is implemented in the Azure CLI program. This will benefit the user by providing immediate feedback on their configuration, whereas the Azure API does not reliably validate these properties.PR Checklist
For example: “
resource_name_here- description of change e.g. adding propertynew_property_name_here”Changes to existing Resource / Data Source
Testing
One unrelated failing acceptance test. This PR does not include any acceptance test changes because this demonstrates that existing valid configurations are still valid despite the tightened rules. If needed, an acceptance test could be added that ensures that invalid configuration triggers the new
CustomizeDiffShimvalidation function.Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_redis_cache- tighten validation forsku_name,family,capacity[azurerm_redis_cache- tighten validation forsku_name,family,capacity#29079]This is a (please select all that apply):
Related Issue(s)
Fixes IPL-7776
Note
If this PR changes meaningfully during the course of review please update the title and description as required.