https://github.com/truefoundry/terraform-truefoundry-sleep
Terraform module to create some Delay/sleep between cloud resources and platform integrations
https://github.com/truefoundry/terraform-truefoundry-sleep
Last synced: 6 months ago
JSON representation
Terraform module to create some Delay/sleep between cloud resources and platform integrations
- Host: GitHub
- URL: https://github.com/truefoundry/terraform-truefoundry-sleep
- Owner: truefoundry
- Created: 2024-12-04T18:02:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-05T07:48:30.000Z (over 1 year ago)
- Last Synced: 2025-02-01T20:12:00.223Z (over 1 year ago)
- Language: HCL
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Truefoundry Terraform Sleep Module
This Terraform module provides a way to add delays/sleep during resource creation or destruction. This can be useful in scenarios where you need to wait for eventual consistency or when you need to introduce delays between resource provisioning.
## Features
- Configurable sleep duration for resource creation
- Configurable sleep duration for resource destruction
- Support for triggers to force new sleep durations
## Usage
```hcl
module "sleep" {
source = "path/to/module"
create_duration = "30s" # Sleep for 30 seconds during creation
destroy_duration = "10s" # Sleep for 10 seconds during destruction
triggers = {
# Changes to these values will trigger a new sleep duration
version = "1.0.0"
}
}
```
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0.0 |
| [time](#requirement\_time) | ~> 0.12.0 |
## Providers
| Name | Version |
|------|---------|
| [time](#provider\_time) | ~> 0.12.0 |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [time_sleep.wait](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [create\_duration](#input\_create\_duration) | Duration to sleep during create operation. Examples: '30s', '5m', '1h' | `string` | `"30s"` | no |
| [destroy\_duration](#input\_destroy\_duration) | Duration to sleep during destroy operation. Examples: '30s', '5m', '1h' | `string` | `"0s"` | no |
| [triggers](#input\_triggers) | Arbitrary map of values that, when changed, will trigger a new sleep duration | `map(string)` | `{}` | no |
## Outputs
| Name | Description |
|------|-------------|
| [id](#output\_id) | ID of the sleep resource that can be used as an explicit dependency |
| [triggers](#output\_triggers) | Map of trigger values that were provided |
## Examples
### Basic Usage
```hcl
module "sleep" {
source = "path/to/module"
create_duration = "1m"
}
```
### With Triggers
```hcl
module "sleep" {
source = "path/to/module"
create_duration = "30s"
triggers = {
deployment_id = "v1.2.3"
environment = "production"
}
}
```
### As a Dependency
```hcl
module "sleep" {
source = "path/to/module"
create_duration = "2m"
}
resource "aws_instance" "example" {
# ... instance configuration ...
depends_on = [module.sleep]
}
```