-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: add group_sync
and role_sync
for coderd_organization_resource
#147
Conversation
return | ||
} | ||
|
||
// data.GroupSync = ??? |
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 recall if you can write to a config block (blocks can't be computed) like this. I suspect you can't.
If you can, I assume it would just be to error if the post-apply plan isn't empty.
For that you'd need to use types.ObjectValueFrom
and provide it the type of the object using a map[string]attr.Type
. I've got an example on the template resource & data source.
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 I figured something out that works 😄
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.
few comments but otherwise nice, lgtm!
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 just realised we're missing enterprise/premium entitlement checks on this and the provisioner key resource. We have them on the workspace proxy and the enterprise features of template resources, but they run during apply
, when they should really run during plan
. Let's not worry about it for now, and at some point I'll see if I can get them working at plan-time using a plan modifier (validators don't have the provider config we need).
If that doesn't work we can just copy the ones at apply-time to these two new resources.
stringvalidator.LengthAtLeast(1), | ||
}, | ||
}, | ||
"auto_create_missing": schema.BoolAttribute{ |
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 defaults to false
on coder right? Should just have a default
set in the schema, and then you can remove the null checks on it.
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 that prevent group_sync
from being null
tho?
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.
Nope, the default only gets computed if the parent is known, so:
group_sync {}
would default any values within it, but omitting the block altogether would not.
If you wanted to default the block to known, and the bool to false, then you'd also add a Default
to the block itself.
Group and role sync settings can now be configured as such: