-
Notifications
You must be signed in to change notification settings - Fork 0
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
TimestreamInfluxDB DB instance add more updatable arguments #7
TimestreamInfluxDB DB instance add more updatable arguments #7
Conversation
…into f-timestreaminfluxdb_db_instance-more-updatable-arguments
Community NoteVoting for Prioritization
For Submitters
|
After this PR is reviewed, I will close it and create an upstream PR. |
@@ -494,6 +519,10 @@ func (r *resourceDBInstance) Update(ctx context.Context, req resource.UpdateRequ | |||
plan.SecondaryAvailabilityZone = flex.StringToFrameworkLegacy(ctx, output.SecondaryAvailabilityZone) | |||
} | |||
|
|||
if plan.SecondaryAvailabilityZone.IsUnknown() { | |||
plan.SecondaryAvailabilityZone = state.SecondaryAvailabilityZone |
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.
This is the fix for secondary_availability_zone
being left as unknown when tags are updated. If the new value (in plan
) is unknown, set it to its old value (in state
).
From what I can determine, the problem is that Update
is called when tags are updated (for some reason) but UpdateDbInstance
isn't actually called, as UpdateDbInstance
doesn't allow tags to be updated, therefore secondary_availability_zone
is left as unknown. I would like a better fix that scaled better for possible future computed values, but at this point I'm not sure what that better fix would be.
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.
might be good to add a small comment regarding this in the code 👍
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.
Added.
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.
Yay, looks good! 🙌
@@ -494,6 +519,10 @@ func (r *resourceDBInstance) Update(ctx context.Context, req resource.UpdateRequ | |||
plan.SecondaryAvailabilityZone = flex.StringToFrameworkLegacy(ctx, output.SecondaryAvailabilityZone) | |||
} | |||
|
|||
if plan.SecondaryAvailabilityZone.IsUnknown() { | |||
plan.SecondaryAvailabilityZone = state.SecondaryAvailabilityZone |
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.
might be good to add a small comment regarding this in the code 👍
}, | ||
Validators: []validator.Int64{ | ||
int64validator.Between(1024, 65535), | ||
int64validator.NoneOf(2375, 2376, 7788, 7789, 7790, 7791, 7792, 7793, 7794, 7795, 7796, 7797, 7798, 7799, 8090, 51678, 51679, 51680), |
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.
(jk)
int64validator.NoneOf(2375, 2376, 7788, 7789, 7790, 7791, 7792, 7793, 7794, 7795, 7796, 7797, 7798, 7799, 8090, 51678, 51679, 51680), | |
int64validator.NoneOf(1337, 2375, 2376, 7788, 7789, 7790, 7791, 7792, 7793, 7794, 7795, 7796, 7797, 7798, 7799, 8090, 51678, 51679, 51680), |
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.
Is that a leetspeak reference?
@@ -215,6 +211,18 @@ func (r *resourceDBInstance) Schema(ctx context.Context, req resource.SchemaRequ | |||
also use the InfluxDB CLI to create an operator token. These attributes will be | |||
stored in a Secret created in AWS SecretManager in your account.`, | |||
}, | |||
names.AttrPort: schema.Int64Attribute{ | |||
Optional: true, | |||
Computed: true, |
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.
would it be redundant to add default here as well?
Computed: true, | |
Computed: true, | |
Default: int64(8086), |
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.
It would be redundant, the port defaults to 8086
anyways when creating an instance.
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.
One comment to address, then looks good.
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.
Looks good!
Add computed to service region
Description
network_type
added as an argument.port
added as an argument.deployment_type
is now updatable.TestAccTimestreamInfluxDBDBInstance_deploymentType
.db_instance_type
is now updatable.TestAccTimestreamInfluxDBDBInstance_dbInstanceType
has been added with an update step.flex.Expand
is no longer used inUpdate
to populate anUpdateDbInstanceInput
struct. This is because aValidationException
will occur when a DB instance is updated with configuration values it already uses.Update
, ifsecondary_availability_zone
is left as unknown, it is set to its previous value.secondary_availability_zone
can be left as unknown when tags are updated, which causes an error.secondary_availability_zone
uses the default value ofnil
. While unconventional, this prevents an error when updatingdeployment_type
.secondary_availability_zone
's value is directly a result of the value ofdeployment_type
.awstypes.StatusDeleted
has been added as a pending state inwaitDBInstanceDeleted
. This is because DB instances are first given the status"DELETED"
before becoming unreachable. This status is not consistent. Using this status as a target status leads to flaky tests. Using this status as a pending status means Terraform will wait until the instance is unreachable.Relations
N/A.
References
Updated
UpdateDbInstanceInput
struct documentation.Output from Acceptance Testing