-
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
aws_elasticache_replication_group: Implement noop MigrateState for v0..v1 #8887
Conversation
* upstream/master: (39 commits) Update CHANGELOG for hashicorp#8850 tests/provider: Add tfproviderlint and enable S001-S005 checks service/kafka: Changes for General Availability Release chore(deps): update module hashicorp/terraform to v0.12.1 deps: github.com/golangci/golangci-lint/cmd/golangci-lint@de1d1ad903cd Update CHANGELOG.md Update CHANGELOG for hashicorp#6322 Retry timeout error for acmpca cert authority Add nil check for S3 bucket metric filter Update cloudwatch_event_target.html.markdown Update module aws/aws-sdk-go to v1.19.42 Add a nil check for reading spot options Update waf_sql_injection_match_set.html.markdown Document the aws_ssm_activation "id" attribute aws_subnet: Increase timeout for delete to 20 mins Secure basic CloudTrail example docs/resource/aws_route53_record: Add NS and SOA Record Management example Update default example to use json instead of form tests/service/waf: Add PreCheck for service availability tests/service/transfer: Add PreCheck for service availability ...
Hey so, I /think/ that this is fine as a no-op (from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @akatrevorjay 👋 Thanks so much for reporting the original issue and submitting this pull request! This is definitely something worth fixing up in the resource. Other than simplifying this a little bit, this seems like the right implementation here!
@@ -223,6 +225,7 @@ func resourceAwsElasticacheReplicationGroup() *schema.Resource { | |||
}, | |||
}, | |||
SchemaVersion: 1, | |||
MigrateState: resourceAwsElasticacheReplicationGroupMigrateState, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is an exceptional case and we want to perform the simplest possible upgrade for compatibility, can you please inline this with the following comments?
MigrateState: resourceAwsElasticacheReplicationGroupMigrateState, | |
// SchemaVersion: 1 did not include any state changes via MigrateState. | |
// Perform a no-operation state upgrade for Terraform 0.12 compatibility. | |
// Future state migrations should be performed with StateUpgraders. | |
MigrateState: func(v int, inst *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) { | |
return inst, nil | |
}, |
I verified this successfully with a Terraform AWS Provider 1.13.0 aws_elasticache_replication_group
resource on Terraform 0.12.1. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll swap over. I do find the replacement more error prone, but either way is fine by me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @akatrevorjay, the passthrough implementation is not more error prone -- MigrateState
and dealing with flatmap state migrations in of the Terraform v0.12's Provider SDK has been superseded with JSON state migrations via StateUpgraders
. In this case, we do not need to worry about doing anything other than passing through the existing InstanceState
to bypass the Terraform runtime error, which matches the Terraform v0.11 Provider SDK in this situation where MigrateState
was not implemented alongside a SchemaVersion
update. We'll be removing the upstream runtime error in the next version of Terraform v0.12 (hashicorp/terraform#21625) to match the old Terraform v0.11 behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! I didn't see any mention of StateUpgraders
in the docs at the time of writing this, I'm guessing I must have missed it! Thanks so much for the explanation!
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Fixes #8828
Release note for CHANGELOG:
Output from acceptance testing: