-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add support for legacyAbac to google_container_cluster
#261
Conversation
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 believe we need to add this field to it's own ForceSendFields
, and then I think we need to consider using default value.
google/resource_container_cluster.go
Outdated
Schema: map[string]*schema.Schema{ | ||
"enabled": { | ||
Type: schema.TypeBool, | ||
Required: 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.
I suspect we want a default value here
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.
Done
google/resource_container_cluster.go
Outdated
@@ -409,6 +424,12 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er | |||
cluster.Description = v.(string) | |||
} | |||
|
|||
if _, ok := d.GetOk("legacy_abac"); ok { |
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.
if the user specifies false
, this block won't get triggered, right? So we'll never send false
, if I recall correctly
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.
In addition, LegacyAbac.Enabled
is a boolean that's marshaled with omitempty
, so even if we do go in here, we won't actually send false
unless this field is added to the LegacyAbac.ForceSendFields
slice.
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.
Good point. Fixed.
google/resource_container_cluster.go
Outdated
@@ -149,6 +149,21 @@ func resourceContainerCluster() *schema.Resource { | |||
Elem: &schema.Schema{Type: schema.TypeString}, | |||
}, | |||
|
|||
"legacy_abac": { |
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.
Are there any other parameters here? Should we simplify this for the users into a simple toggle?
enable_legacy_abac
?
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.
Yeah, I was leaving the option open in case any others get added, but realistically I don't think they will so I went ahead and made the change.
@@ -291,6 +317,7 @@ func testAccCheckContainerCluster(n string) resource.TestCheckFunc { | |||
{"description", cluster.Description}, | |||
{"endpoint", cluster.Endpoint}, | |||
{"instance_group_urls", igUrls}, | |||
{"legacy_abac.0.enabled", strconv.FormatBool(cluster.LegacyAbac.Enabled)}, |
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 don't believe this is accurately testing this as the code stands. We can't send false, so we never actually change the value. The test doesn't seem to verify that the value is now false.
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.
Yup, you're right. Fixed.
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 took it for a spin and everything checked out, thanks!
* revendor container api * Add support for legacyAbac to `google_container_cluster` * change to single enabled field
* revendor container api * Add support for legacyAbac to `google_container_cluster` * change to single enabled field
<!-- This change is generated by MagicModules. --> /cc @Chupaka
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! |
terraform-google-modules/terraform-google-kubernetes-engine#261 Bumbed minimal provider version to 2.18
Fixes #219.