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

Feature: added security_policy_id to resource definition #425

Merged
merged 10 commits into from
Nov 28, 2023

Conversation

vmanilo
Copy link
Contributor

@vmanilo vmanilo commented Nov 10, 2023

Resolves #380

Tests passes: https://github.com/vmanilo/terraform-provider-twingate/actions/runs/6900109331/job/18772776593?pr=37

Changes

  • added optional security_policy_id attribute to Resource definition

@vmanilo vmanilo marked this pull request as ready for review November 10, 2023 03:46
@vmanilo vmanilo requested a review from a team as a code owner November 10, 2023 03:46
@twingate-blee
Copy link
Member

My resource was set to "Default Policy". I then used security_policy_id to set it to a different security policy lets call it "Test Policy". I then removed security_policy_id and ran Terraform which set the the value to null

security_policy_id = "U2VjdXJpdHlQb2xpY3k6Njk4MjA=" -> null

I was thinking that my resources would go back to "Default Policy" but it stayed on "Test Policy"

For me to get back to default state I had to security_policy_id to the "Default Policy" then run terraform then I was able to delete security_policy_id.

We might want to explain that removing security_policy_id will still use the current policy and not go back to the previous policy.

Copy link
Contributor

@romankor romankor left a comment

Choose a reason for hiding this comment

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

see comments

@vmanilo
Copy link
Contributor Author

vmanilo commented Nov 14, 2023

@twingate-blee this behaviour was not specified in spec, that's why it was missing
but now I've updated implementation

@twingate-blee
Copy link
Member

My resource was set to "Default Policy". I then used security_policy_id to set it to a different security policy lets call it "Test Policy". I then removed security_policy_id and ran Terraform which set the the value to null

security_policy_id = "U2VjdXJpdHlQb2xpY3k6Njk4MjA=" -> null

I was thinking that my resources would go back to "Default Policy" but it stayed on "Test Policy"

For me to get back to default state I had to security_policy_id to the "Default Policy" then run terraform then I was able to delete security_policy_id.

We might want to explain that removing security_policy_id will still use the current policy and not go back to the previous policy.

I retested after your update and verified that if you remove security_policy_id it defaults to "Default Policy". I also tested setting the security policy to another policy from the UI. Ran terraform without security_policy_id and verified that it didn't try to change it to "Default Policy"

@vmanilo
Copy link
Contributor Author

vmanilo commented Nov 15, 2023

I see, working on it

@vmanilo
Copy link
Contributor Author

vmanilo commented Nov 15, 2023

hey @twingate-blee I've pushed a commit to address your comment
please give it a try

@vmanilo vmanilo requested review from ekampf and liorr as code owners November 17, 2023 04:40
@twingate-blee twingate-blee self-requested a review November 20, 2023 21:36
@ekampf ekampf enabled auto-merge (squash) November 28, 2023 18:07
@ekampf ekampf disabled auto-merge November 28, 2023 18:07
Copy link
Contributor

@romankor romankor left a comment

Choose a reason for hiding this comment

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

GTM

@ekampf ekampf merged commit d554f26 into Twingate:main Nov 28, 2023
8 checks passed
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.

Add support for policy on resource definition
4 participants