Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 944 Bytes

README.md

File metadata and controls

31 lines (21 loc) · 944 Bytes

R018

The R018 analyzer reports time.Sleep() function usage. Terraform Providers should generally avoid this function when waiting for API operations and prefer polling methods such as resource.Retry() or (resource.StateChangeConf).WaitForState().

Flagged Code

time.Sleep(10)

Passing Code

err := resource.Retry(/* ... */)

Or

stateConf := resource.StateChangeConf{/* ... */}
_, err := stateConf.WaitForState()

Ignoring Reports

Singular reports can be ignored by adding the a //lintignore:R018 Go code comment at the end of the offending line or on the line immediately proceding, e.g.

//lintignore:R018
time.Sleep(10)