-
Notifications
You must be signed in to change notification settings - Fork 1.8k
adding new resource google_bigtable_gc_policy #3293
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
Conversation
Actually if you re-create |
Hi @rileykarson I am not very familiar with feature process, but this would be a great addition to enable management of bigtable. |
Sorry for the radio silence on my end here! At first glance, your contribution looks great, but I'm wondering if this is something we should add to this provider. It's come up with a few other APIs- BigQuery, Spanner, etc. where we're not sure whether some features are GCP or "data" level. In general, we want to keep this provider focused on provisioning GCP infrastructure and not performing "data" operations on services- even those exclusive to GCP. Since this isn't exposed in the Bigtable Admin API, I'm inclined to say this falls more on the data side, but I'll bring this up with the rest of my team in our sync later this week. |
@rileykarson I understood but is like "lifecycle" ressources, I not agree with "data" level Furthermore is actually documented here below modifyColumnFamilies |
Understood! We're weighing some considerations to make a decision about whether it falls into the scope of the Google provider or not. |
@rileykarson Any news? |
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.
Previously, I was slightly 👎 on adding this because it wasn't represented in the REST Admin API, but that wasn't accurate. https://cloud.google.com/bigtable/docs/reference/admin/rest/v2/projects.instances.tables/modifyColumnFamilies#GcRule. The interface to the admin API / this client lib are a little different, so I guess I didn't notice it before.
It looks like some validation added in Terraform 0.12
made the test fail; retyping the field to TypeList
(TypeMap
works in very limited circumstances, not including this one) will resolve that.
return resourceBigtableGCPolicyRead(d, meta) | ||
} | ||
|
||
func resourceBigtableGCPolicyRead(d *schema.ResourceData, meta interface{}) error { |
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 it possible to recreate a GCPolicy from the string in FamilyInfo? https://github.com/terraform-providers/terraform-provider-google/blob/ab7c29f09dafc6d836888b3db57b53f148e37727///vendor/cloud.google.com/go/bigtable/admin.go#L231
Drift detection would be nice if it can, but it's not a must-have.
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's weird I forget about this, you mean about the SetId("...") to ensure nothing change between two plan/apply? If yes, should be good now
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.
The id
value won't actually change anything, so not setting it is fine. I'm curious whether we can extract values like max_age
from the GCPolicy string, so we can set those in state.
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.
I see, it's probably possible, but I thinking about all cases, what if Google change something? Or add another policy? I am not even sure order of the policy is guaranteed (can be max_age && max_version / max_version && max_age)
I wonder, what's happen in terraform if you have 2 resources, with the same ID (actually, that can happen if you set same gc policy on two table), should I prefix ID with the column name?
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.
2 resources can share an id, Terraform only distinguishes between the id
value being unset and set.
Signed-off-by: Kevin Labesse <[email protected]>
Signed-off-by: Kevin Labesse <[email protected]>
Signed-off-by: Kevin Labesse <[email protected]>
Signed-off-by: Kevin Labesse <[email protected]>
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.
I ran the tests and they panicked. I think it's because of the type change, commented inline with a likely fix.
} | ||
|
||
if aok { | ||
d, err := strconv.Atoi(ma.(map[string]interface{})["days"].(string)) |
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.
I think that ma
needs to be converted to []interface{}
, and the 0
element should be a map[string]interface{}
.
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.
I've change, not sure I should check if slice has at least one element, shouldn't go in this statement if value isn't set in .tf files
} | ||
|
||
if vok { | ||
n, err := strconv.Atoi(mv.(map[string]interface{})["number"].(string)) |
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.
Same as above.
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.
Sorry for taking so long to get back to this! We've updated our plugin SDK since the last pass I made, do you mind replacing the github.com/hashicorp/terraform/
imports with github.com/hashicorp/terraform-plugin-sdk/
?
Signed-off-by: Kevin Labesse <[email protected]>
@rileykarson Sure, no problem. I've update the resource file (and test) |
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.
LGTM. Thanks for contributing, @eraac! Sorry about the delay in getting back to this.
I'm going to upstream this change to Magic Modules so that it's applied to the google-beta
provider as well, and then merge this PR.
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. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Adding new resource for manage garbage collection into bigtable