-
Notifications
You must be signed in to change notification settings - Fork 28
[vercel_team_config] Fix saml dsync for access groups #298
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
base: main
Are you sure you want to change the base?
Conversation
), | ||
Computed: true, | ||
ElementType: types.ObjectType{ | ||
AttrTypes: map[string]attr.Type{ |
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 would like to add a validator that exactly one of role
or access_group_id
is present, but couldn't make it work
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 this just ends up being a marshalling error when we go to hit the RPCs? we could explicitly check it, not sure if terraform provides a hook for that. doug knows way more than I do on this stuff.
Enforced bool `json:"enforced"` | ||
Roles map[string]string `json:"roles"` | ||
Enforced bool `json:"enforced"` | ||
Roles map[string]any `json:"roles"` |
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.
any
is pretty gnarly here, when we just need to support marshaling, a union type is only a few more lines of 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.
Nice, how do I do the union type?
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.
something like:
type UpdatSamlConfigRole struct {
Role *string
AccessGroupID *string
}
func (r *UpdateSamlConfigRole) MarshalJSON() ([]byte, error) {
if r.Role != nil { return json.Marshal(*r.Role) }
if r.AccessGroupID != nil { return json.Marshal(*r.AccessGroupID) }
return nil, fmt.Errorf("bad union")
}
At the moment, the
vercel_team_config
resource incorrectly implements Access Group support. If a team has SAML roles mapped access groups, the provider deletes the mappings.This PR fixes the access group mappings for SAML Roles.
The change is breaking 👇 @dglsparsons @jarneson let me know what you think is the best way forward with the breaking changes. Would it be sufficient to rename
roles
?