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

retry in case of empty response while fetching resource #343

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

Conversation

harshavmb
Copy link

This PR is an additional retry function with azapi_resource data provider.

The use case for this retry logic is that we have few Azure policies to update DNS configuration of private endpoints created by various users. There is some slight delay between the private endpoint resource creation & the Azure policy to create A-record & update the private endpoint DNS configuration. We have seen the time lag of up to 30-40 seconds.

Currently, we are using either null_resource & sleep providers. We wait deliberately for certain time expecting the configuration to be updated. Nevertheless, it's not a clean solution. We create inherent dependency on az-cli.

With this retry logic, azapi_resource data provider retries until non empty response is returned by the Azure API.

I know retrying bluntly on empty response isn't wise but I'm open to your suggestions.

@harshavmb
Copy link
Author

@microsoft-github-policy-service agree

@microsoft-github-policy-service agree

@harshavmb
Copy link
Author

Hi,

Any update on this PR?

@ms-henglu
Copy link
Collaborator

Hi @harshavmb ,

Thank you so much for taking time to work on this feature! And apologize for the late response.

We'll think about this feature request and improve it.

@ms-henglu
Copy link
Collaborator

We received a related feature request: #372

@harshavmb
Copy link
Author

Hi @ms-henglu ,

I'm afraid the feature request you linked isn't the one this PR is about. It's not the resource, it's a data provider.
As I explained in the PR description, the create part is handled by Azure policies which have few seconds of latency & with data providers we would like to retry until the ARM resource is created by the policy.

@matt-FFFFFF
Copy link
Member

I think #372 could cover both data sources and resources, using a common retry function.

@matt-FFFFFF
Copy link
Member

Although, it might be a different scenario if the API does not return an error (which, I think it should)

@harshavmb
Copy link
Author

Hi @matt-FFFFFF ,

Indeed if you prefer to have a common function, both resources & data sources could use that but I would like to have this available with data sources too as we have different use-cases than the one mentioned in #372.

@MatLambethMS
Copy link

Hi folks. How is this one looking? This feature would be extremely useful and looks like a lot of the hard work has been done.

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.

None yet

4 participants