Skip to content

feat: Implement rotating pats #3843

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
merged 41 commits into from
Jul 22, 2025
Merged

feat: Implement rotating pats #3843

merged 41 commits into from
Jul 22, 2025

Conversation

sfc-gh-jmichalak
Copy link
Collaborator

@sfc-gh-jmichalak sfc-gh-jmichalak commented Jul 7, 2025

Add the remaining features of the user PAT resource:

  • Add rotation to the snowflake_user_programmatic_access_token resource
  • Add a practical example of rotating tokens with an external resource.
  • Add a new output field for the old token name after rotation.
  • Add missing labels.

@sfc-gh-jmichalak sfc-gh-jmichalak force-pushed the implement-rotating-pats branch from f8c1cf1 to 964de07 Compare July 7, 2025 14:33
Copy link

github-actions bot commented Jul 7, 2025

Integration tests cancelled for f8c1cf1aa4ffeef159c35465f43670fc7e193777

Copy link

github-actions bot commented Jul 7, 2025

Account-level tests failure for f8c1cf1aa4ffeef159c35465f43670fc7e193777

Copy link

github-actions bot commented Jul 7, 2025

Account-level tests failure for 964de07c9c205385fc46a9e61689fb3a1e8335b7

Copy link

github-actions bot commented Jul 7, 2025

Integration tests failure for 964de07c9c205385fc46a9e61689fb3a1e8335b7

Copy link

Account-level tests success for 8a6e3fd2bc306e3794f4075de6644ede6f0d95bc

Copy link

Integration tests success for 8a6e3fd2bc306e3794f4075de6644ede6f0d95bc

},
},
})
}

// TODO(next PR): add tests for rotating the token
func TestAcc_UserProgrammaticAccessToken_rotating(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was also thinking that we should have an acceptance test checking the path from the example (using time_rotation resource). It would validate and document what we are proposing.

You would need to:

  • add this to the test definition:
		ExternalProviders: map[string]resource.ExternalProvider{
			"time": {
				VersionConstraint: "0.13.1",
				Source:            "hashicorp/time",
			},
		},

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Next PRs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oke

Base automatically changed from add-pat-ds to dev July 21, 2025 18:49
Copy link

Integration tests cancelled for e772b93a09397dd2a94020d9f4f6857697e6bddd

Copy link

Integration tests cancelled for a34a12a6edb17832bf74b4c5d7c0dde7204efcda

Copy link
Collaborator Author

@sfc-gh-jmichalak sfc-gh-jmichalak left a comment

Choose a reason for hiding this comment

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

I altered the resource as discussed, mainly:

  • the token is not rotated when the keeper field is added or removed
  • the keeper field is now a string
  • all docs are updated
  • follow-up tests (with the time_rotating resource and computed values) can be done in the next PR.

},
},
})
}

// TODO(next PR): add tests for rotating the token
func TestAcc_UserProgrammaticAccessToken_rotating(t *testing.T) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Next PRs.

Copy link

Account-level tests failure for e772b93a09397dd2a94020d9f4f6857697e6bddd

Copy link

Account-level tests failure for a13e3c8f034da237d199b9a5022be9a960525ef3

Copy link

Integration tests failure for a13e3c8f034da237d199b9a5022be9a960525ef3

@sfc-gh-jmichalak sfc-gh-jmichalak merged commit c99f84d into dev Jul 22, 2025
13 of 15 checks passed
@sfc-gh-jmichalak sfc-gh-jmichalak deleted the implement-rotating-pats branch July 22, 2025 14:03
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.

3 participants