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 'waiting until resource is ready' on create #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johanols
Copy link

@johanols johanols commented Jun 1, 2021

This adds a feature where the provider waits until a resource is ready.
To determine that two new schema parameters were added:

  • create_ready_key
  • create_ready_value

After creating the resource and if set, the object is repeatedly read
and validated using these two parameters. As soon as the value
corresponds to the resource value at key the provider will deem the
resource ready and continue execution.

The default timeout for checking readiness is 10 minutes. Use
Terraform's 'timeouts' argument to override.

Issue: #33

@jonathan-kaufman-by
Copy link

This is awesome, and would be very useful to me.

@theochita
Copy link

Hi @johanols Can you fix the merge conflicts?, i made a conflict free branch of your code in my own repo can you can check out if it helps. https://github.com/theochita/terraform-provider-restapi/tree/johanols-feature/wait_for_ready_on_create

@DRuggeri Any thoughts on this feature?, it helps us be able to interface with async api's that returns an awaitable task, which should be polled every few sec until its finished.

This adds a feature where the provider waits until a resource is ready.
To determine that two new schema parameters were added:

* create_ready_key
* create_ready_value

After creating the resource and if set, the object is repeatedly read
and validated using these two parameters. As soon as the value
corresponds to the resource value at key the provider will deem the
resource ready and continue execution.

The default timeout for checking readiness is 10 minutes. Use
Terraform's 'timeouts' argument to override.

Issue: Mastercard#33
@johanols johanols force-pushed the feature/wait_for_ready_on_create branch from 8a1a502 to 5df62dc Compare February 28, 2023 19:16
@johanols
Copy link
Author

johanols commented Feb 28, 2023

I've fixed the merge conflicts now @theochita. I also adjusted the imports of resource to use v2 or the Plugin SDK. No need for any other adjustments. Tests ran through without any issues.

@fancybear-dev
Copy link

Would be amazing if the provider would support this!

@fancybear-dev
Copy link

fancybear-dev commented Mar 28, 2023

Could this be merged? Would really appreciate it! cc @DRuggeri

@fancybear-dev
Copy link

fyi; we have forked and will maintain our changes at https://github.com/hnhdev/terraform-provider-restapi

Would still be great to see it merged, but at least we are not dependent anymore.

@fancybear-dev
Copy link

We ended up not using this PR, as it only supports create method. This is how we implemented it for our specific usecase (all CRUD functions supported, async);

hnhdev@c023978

@fgimenezm
Copy link

+1 to this feature.
Looks like @johanols branch has conflicts now since it's been so long since he submitted the PR :-(

@DRuggeri
Copy link
Member

DRuggeri commented Mar 1, 2024

Wow - I don't know how I haven't seen this PR until just now!!!! SO SORRY for the long delay - I've done several feature reviews since this was opened and dropped the ball!

I like this concept quite a bit because there are a number of APIs that are primarily async, but do have some reservations. As @fancybear-dev points out, it only supports the create operation, so we would need to have a think on what update and destroy should look like. I would surmise they look roughly the same.
One area I am waffling a little is on the configuration parameters. There are a bunch of config params already in the provider and they seem potentially overwhelming for new users. Would it make sense to place these parameters in an asynchronous subkey to the provider to keep them "together" and hopefully less daunting to a new user?

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.

6 participants