-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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_replication_group recreates resource on engine_version upgrade #28011
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
I'm seeing this issue when upgrading from 6 => 7 as well. It does a drop and replace. |
I was able to replicate the bug: package main
import (
"fmt"
gversion "github.com/hashicorp/go-version"
"math"
"regexp"
)
const (
redisVersionPreV6RegexpRaw = `[1-5](\.[[:digit:]]+){2}`
redisVersionPostV6RegexpRaw = `(([6-9])\.x)|([6-9]\.[[:digit:]]+)`
redisVersionRegexpRaw = redisVersionPreV6RegexpRaw + "|" + redisVersionPostV6RegexpRaw
)
const (
redisVersionRegexpPattern = "^" + redisVersionRegexpRaw + "$"
redisVersionPostV6RegexpPattern = "^" + redisVersionPostV6RegexpRaw + "$"
)
var (
redisVersionRegexp = regexp.MustCompile(redisVersionRegexpPattern)
redisVersionPostV6Regexp = regexp.MustCompile(redisVersionPostV6RegexpPattern)
)
func normalizeEngineVersion(version string) (*gversion.Version, error) {
if matches := redisVersionPostV6Regexp.FindStringSubmatch(version); matches != nil {
if matches[1] != "" {
version = fmt.Sprintf("%s.%d", matches[2], math.MaxInt)
} else if matches[3] != "" {
version = matches[3]
}
}
return gversion.NewVersion(version)
}
func main() {
oVersion, _ := normalizeEngineVersion("6.x")
nVersion, _ := normalizeEngineVersion("6.0")
print(nVersion.LessThan(oVersion))
} This return When comparing two versions: func main() {
oVersion, _ := normalizeEngineVersion("6.0")
nVersion, _ := normalizeEngineVersion("6.2")
print(nVersion.LessThan(oVersion))
} Works as expected returning |
Looks like changing this: const (
redisVersionRegexpPattern = "^" + redisVersionRegexpRaw + "$"
redisVersionPostV6RegexpPattern = "^" + redisVersionPostV6RegexpRaw + "$"
) to: const (
redisVersionRegexpPattern = "^(?:" + redisVersionRegexpRaw + ")$"
redisVersionPostV6RegexpPattern = "^(?:" + redisVersionPostV6RegexpRaw + ")$"
) works fine, as with the previous implementation |
This functionality has been released in v5.22.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! |
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. |
Terraform Core Version
v1.3.5
AWS Provider Version
v4.40.0
Affected Resource(s)
Expected Behavior
When upgrading the
aws_elasticache_replication_group
engine_version
from any version to any version to upgrade the resource in-place, just like in the AWS Console.Actual Behavior
When upgrading from version
2.8.24
to any other higher version, the plan wants to destroy and recreate the resource.Upgrading from any other higher version to a higher version works as expected.
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
2.8.24
terraform plan
The plan will attempt to destroy-recreate the resource instead of upgrading in place.
Debug Output
No response
Panic Output
No response
Important Factoids
According to the CloudFormation documentation on the Engine version, the upgrade should happen in place, with no down time.
References
Would you like to implement a fix?
Yes
The text was updated successfully, but these errors were encountered: