Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log
crash.*.log

# Exclude all .tfvars files, which are likely to contain sensitive data
*.tfvars
*.tfvars.json

# Ignore override files as they are usually used for local development
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Ignore CLI configuration files
.terraformrc
terraform.rc

# Ignore lock files
.terraform.lock.hcl

# OS specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
40 changes: 30 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Terraform Sleep Module
# 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.

Expand All @@ -22,32 +22,50 @@ module "sleep" {
}
}
```

<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| terraform | >= 0.13.0 |
| time | ~> 0.9.0 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
| <a name="requirement_time"></a> [time](#requirement\_time) | ~> 0.12.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_time"></a> [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 | Duration to sleep during create operation. Examples: '30s', '5m', '1h' | `string` | `"30s"` | no |
| destroy_duration | Duration to sleep during destroy operation. Examples: '30s', '5m', '1h' | `string` | `"0s"` | no |
| triggers | Arbitrary map of values that, when changed, will trigger a new sleep duration | `map(string)` | `{}` | no |
| <a name="input_create_duration"></a> [create\_duration](#input\_create\_duration) | Duration to sleep during create operation. Examples: '30s', '5m', '1h' | `string` | `"30s"` | no |
| <a name="input_destroy_duration"></a> [destroy\_duration](#input\_destroy\_duration) | Duration to sleep during destroy operation. Examples: '30s', '5m', '1h' | `string` | `"0s"` | no |
| <a name="input_triggers"></a> [triggers](#input\_triggers) | Arbitrary map of values that, when changed, will trigger a new sleep duration | `map(string)` | `{}` | no |

## Outputs

| Name | Description |
|------|-------------|
| id | ID of the sleep resource that can be used as an explicit dependency |
| triggers | Map of trigger values that were provided |
| <a name="output_id"></a> [id](#output\_id) | ID of the sleep resource that can be used as an explicit dependency |
| <a name="output_triggers"></a> [triggers](#output\_triggers) | Map of trigger values that were provided |
<!-- END_TF_DOCS -->

## Examples

### Basic Usage

```hcl
module "sleep" {
source = "path/to/module"
Expand All @@ -57,6 +75,7 @@ module "sleep" {
```

### With Triggers

```hcl
module "sleep" {
source = "path/to/module"
Expand All @@ -70,6 +89,7 @@ module "sleep" {
```

### As a Dependency

```hcl
module "sleep" {
source = "path/to/module"
Expand All @@ -86,4 +106,4 @@ resource "aws_instance" "example" {

## License

MIT Licensed. See LICENSE for full details.
MIT Licensed. See LICENSE for full details.
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
terraform {
required_version = ">= 1.0.0"

required_providers {
time = {
source = "hashicorp/time"
version = "~> 0.9.0"
version = "~> 0.12.0"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ output "id" {
output "triggers" {
description = "Map of trigger values that were provided"
value = time_sleep.wait.triggers
}
}
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ variable "triggers" {
description = "Arbitrary map of values that, when changed, will trigger a new sleep duration"
type = map(string)
default = {}
}
}