Add data_region to the recognized fields#28
Conversation
PetrHeinz
left a comment
There was a problem hiding this comment.
Thanks for adding the new parameter!
| "data_region": { | ||
| Description: "Region where we store your data.", | ||
| Type: schema.TypeString, | ||
| Optional: true, | ||
| DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { | ||
| return d.Id() != "" | ||
| }, | ||
| }, |
There was a problem hiding this comment.
I'm not sure whether the DiffSuppressFunc is the way to go here 🤔
If I understand it correctly, we want the data_region to be readable from the API response if not provided (this should be optional + computed), and it cannot be changed during the resource existence - this can be done via force new, would recreate the source on region change.
| "data_region": { | |
| Description: "Region where we store your data.", | |
| Type: schema.TypeString, | |
| Optional: true, | |
| DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { | |
| return d.Id() != "" | |
| }, | |
| }, | |
| "data_region": { | |
| Description: "Region where we store your data.", | |
| Type: schema.TypeString, | |
| Optional: true, | |
| Computed: true, | |
| ForceNew: true, | |
| }, |
With this config it should be possible to add data_region to sourceRef without any special handling. WDYT?
In the current implementation I would worry about people changing the data_region and nothing happening. Not sure how exactly would it behave if no region was provided - would it be null in the terraform state?
There was a problem hiding this comment.
Thanks Petr! I didn't want ForceNew since I didn't want accidental new sources created just by changing this one field
There was a problem hiding this comment.
But then you could intentionally rewrite the field, think you have your source in a different region, but nothing would happen. If we don't want to support force new, we should throw an error in that case, ideally in the plan phase.
There was a problem hiding this comment.
Error when you try to change the data_region sounds good to me, can you take over please @PetrHeinz? 🙏
There was a problem hiding this comment.
Amazing, thank you Petr!
No description provided.