Skip to content
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

Adding support for null BoolOption values to TF provider #52430

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

eriktate
Copy link
Contributor

@eriktate eriktate commented Feb 24, 2025

The terraform provider coerces BoolOption values into either true or false rather than allowing for fields to be null. This PR adds an alias called NullBoolOption that can be specified for fields where null and false are semantically different. I believe this was the original intended behavior for BoolOption values, but I opted to add the alias to avoid changing existing behavior in a way that might not be backwards compatible.

changelog: Fixed an issue preventing the use of the ssh_port_forwarding role option when using the terraform provider.

Copy link
Contributor

@hugoShaka hugoShaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a heavily breaking change and should not be backported. If the option was not set at all, we applied the defaults. However if one of the role topion fields was set, we defaulted all the others to false.

Doing this change will turn them back to their teleport default value, potentially changing the user's roles and allowing things like X11 forwarding. I think this is worth fixing, but we should do it in a major version, with the apropriate warnings and explanations in the changelog.

As I lacked the time to do it in v17, I only fixed the token bools. If we do fix the role bools as well, we should merge the token tfschema back into the main one.

See #40283 for more details

@eriktate eriktate force-pushed the eriktate/fix-tf-role-port-forwarding branch 3 times, most recently from 67d74eb to ca07f50 Compare March 5, 2025 20:31
@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from tigrato March 11, 2025 14:39
eriktate and others added 5 commits March 11, 2025 10:42
…n schema back into the main tfschema, and marking flags with default values as computed
… state value

The previous commits from Erik are fixing the role options default
computation. This is great but surfaces a new issue: our TF provider
doers not behave properly when default logic changes as it keeps using
the value from its state.

This commit makes Terraform re-compute the role.spec.options from the
original user config instead of the state. This makes sure that TF
options are the same regardless of which TF provider version created the
resource initially.
@eriktate eriktate force-pushed the eriktate/fix-tf-role-port-forwarding branch from be83200 to c52c7ea Compare March 11, 2025 14:49
@eriktate eriktate force-pushed the eriktate/fix-tf-role-port-forwarding branch from c52c7ea to 92794b5 Compare March 11, 2025 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants