Skip to content

feat: add template max port sharing level attribute #110

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

Merged

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Sep 30, 2024

This is a somewhat hacky, temporary, solution to #108.

Prior to Coder v2.15.0 (via coder/coder#14366), it was not possible to set the max port sharing level when the template was created. To retain compatibility between the template resource and older, supported, versions of Coder, the provider will make a PATCH request immediately after creating the template to set the max port sharing level.

When we no longer support versions of Coder prior to v2.15.0, we'll remove the redundant update request.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ethanndickson and the rest of your teammates on Graphite Graphite

@ethanndickson ethanndickson force-pushed the 09-30-feat_add_template_max_port_sharing_level_attribute branch 2 times, most recently from bc9fa48 to 92e865b Compare September 30, 2024 04:50
@ethanndickson ethanndickson marked this pull request as ready for review September 30, 2024 04:56
@ethanndickson ethanndickson force-pushed the 09-30-feat_add_template_max_port_sharing_level_attribute branch from 92e865b to dcf7db0 Compare September 30, 2024 04:56
@ethanndickson ethanndickson merged commit 880e17d into main Oct 1, 2024
14 checks passed
@ethanndickson ethanndickson deleted the 09-30-feat_add_template_max_port_sharing_level_attribute branch October 1, 2024 04:20
ethanndickson added a commit that referenced this pull request Feb 26, 2025
… is default (#190)

Closes #188.

For context, the `MaxPortShareLevel` template metadata value was not
present on the `coderd` create template request prior to 2.15. As such,
during template creation we need to send an update request for backwards
compatibility (though we could probably remove this soon), see #110.

Whilst we don't send this update request is the attribute is omitted on
the resource, we were sending a spurious update request if the value was
explicitly configured to the default value ('owner' for enterprise+,
'public' otherwise). This was causing the error in the linked issue. An
example is seen in the newly added test.

The fix is to just not send that update request if the configured value
is:
- Unknown
- Equal to the value on the newly created template.

note: I'd recommend hiding the whitespace when reviewing the diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants