Skip to content

feat: Timeout improvements for SDKv2 resources #3526

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 4 commits into from
Jul 28, 2025

Conversation

oarbusi
Copy link
Collaborator

@oarbusi oarbusi commented Jul 24, 2025

Description

  • Reviewed if there was any resource with long last operations with state transitions defining a timeout value > 20min
    and No Timeout configuration defined in the schema.Resource. mongodbatlas_online_archive needed to add timeout definition on the schema
  • Additionally, applied the good practice of having the timeout of the state transition be smaller that the timeout of the actual operation (reference).

Link to any related issue(s): CLOUDP-306804

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR. A migration guide must be created or updated if the new feature will go in a major version.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR. A migration guide must be created or updated.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contributing guides
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals I have added appropriate changelog entries.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

@oarbusi oarbusi changed the title feat: timeout improvements feat: Timeout improvements for SDKv2 resources Jul 25, 2025
@oarbusi oarbusi marked this pull request as ready for review July 25, 2025 09:26
@Copilot Copilot AI review requested due to automatic review settings July 25, 2025 09:26
@oarbusi oarbusi requested review from a team as code owners July 25, 2025 09:26
Copy link
Contributor

APIx bot: a message has been sent to Docs Slack channel

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves timeout handling for MongoDB Atlas Terraform provider resources by implementing proper timeout configurations for SDKv2 resources with long-running operations.

  • Adds timeout schema configuration to mongodbatlas_online_archive resource with 3-hour default
  • Applies best practice of setting StateChangeConf timeouts to be 1 minute less than CRUD operation timeouts
  • Updates multiple resources to use proper timeout calculations to avoid SDK context deadline errors

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/service/onlinearchive/resource_online_archive.go Adds timeout schema configuration and updates StateChangeConf timeout calculation
internal/service/privatelinkendpointservice/resource_privatelink_endpoint_service.go Updates StateChangeConf timeout calculations for create operations
internal/service/privatelinkendpoint/resource_privatelink_endpoint.go Updates StateChangeConf timeout calculation for create operation
internal/service/networkpeering/resource_network_peering.go Updates StateChangeConf timeout calculation for create operation
internal/service/clusteroutagesimulation/resource_cluster_outage_simulation.go Updates StateChangeConf timeout calculation and removes unused variable
docs/resources/online_archive.md Documents the new timeouts attribute for online archive resource
.changelog/3526.txt Adds changelog entry for the timeout enhancement

Copy link
Collaborator

@xargom xargom left a comment

Choose a reason for hiding this comment

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

LGTM after addressing some minor comments.

Copy link
Collaborator

@EspenAlbert EspenAlbert left a comment

Choose a reason for hiding this comment

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

Nice. I would also consider changing the other parameters to be more consistent:

  • MinTimeout
  • Delay

Seems like we hard-code anything from 3s to 3min.
Suggestion: ~ 1 * time.Minute for MinTimeout and ~30s for Delay (I think this is the delay before retrying)

Co-authored-by: Javier Armendáriz <136641722+xargom@users.noreply.github.com>
@oarbusi oarbusi merged commit 0ef10fc into CLOUDP-320243-dev-2.0.0 Jul 28, 2025
42 checks passed
@oarbusi oarbusi deleted the CLOUDP-306804 branch July 28, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants