-
Couldn't load subscription status.
- Fork 122
Add inactivity_timeout support to Fleet agent policy resource with duration string type and version validation #1285
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: tobio <[email protected]>
…ature Co-authored-by: tobio <[email protected]>
Copilot
AI
changed the title
[WIP] [Bug] Not possible to set inactivity_timeout in a Fleet policy
Add inactivity_timeout support to Fleet agent policy resource
Sep 8, 2025
Copilot finished work on behalf of
tobio
September 8, 2025 00:33
tobio
reviewed
Sep 8, 2025
- Added MinVersionInactivityTimeout constant for 8.7.0 - Added SupportsInactivityTimeout field to features struct - Updated buildFeatures to check for inactivity timeout support - Added version validation in toAPICreateModel and toAPIUpdateModel - Updated test to use proper version check for inactivity_timeout Co-authored-by: tobio <[email protected]>
- Added unit tests to verify MinVersionInactivityTimeout constant - Added comprehensive validation tests for version checking logic - Verified version validation works for both create and update operations - Ensured null/unset inactivity_timeout values don't trigger validation errors Co-authored-by: tobio <[email protected]>
Copilot
AI
changed the title
Add inactivity_timeout support to Fleet agent policy resource
Add inactivity_timeout support to Fleet agent policy resource with version validation
Sep 8, 2025
Copilot finished work on behalf of
tobio
September 8, 2025 02:25
tobio
reviewed
Sep 8, 2025
… agent policy Co-authored-by: tobio <[email protected]>
tobio
reviewed
Sep 8, 2025
dimuon
reviewed
Sep 9, 2025
dimuon
reviewed
Sep 9, 2025
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.
Besides one nit-pick question, it looks good 👍 Also it makes sense to redefine the timeout as a string duration.
…rsion Co-authored-by: tobio <[email protected]>
Co-authored-by: tobio <[email protected]>
Copilot
AI
changed the title
Add inactivity_timeout support to Fleet agent policy resource with version validation
Add inactivity_timeout support to Fleet agent policy resource with duration string type and version validation
Sep 10, 2025
Copilot finished work on behalf of
tobio
September 10, 2025 11:12
…fy test helpers Co-authored-by: tobio <[email protected]>
wandergeek
approved these changes
Sep 10, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes Made
Duration String Implementation
inactivity_timeoutas optional, computed String attribute usingcustomtypes.DurationType"30s","2m","1h"instead of raw secondsCore Features
Code Review Updates
Field Handling Fix
The previous implementation would always set
SupportsAgentlessandInactivityTimeoutfields in the API request body usingValueBoolPointer()andValueFloat32Pointer(), which return pointers to zero values (false/0) when the Terraform values are unknown. This could send unintended values to the API.The fix moves the body declaration above version checks and only sets these fields conditionally when their values are actually known, preventing zero-value pointers from being sent to the API for unknown attributes.
Duration Type Benefits
Users can now specify timeouts using intuitive duration strings:
inactivity_timeout = "30s"(30 seconds)inactivity_timeout = "2m"(2 minutes)inactivity_timeout = "1h"(1 hour)The implementation maintains full compatibility with the Fleet API while providing a much more user-friendly interface that follows Go duration string conventions.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.