Difference between revisions of "Terraform resource: time sleep"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
{{lc}} | {{lc}} | ||
https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep | https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep | ||
+ | |||
+ | <pre> | ||
+ | resource "aws_ram_resource_association" "example" { | ||
+ | resource_arn = aws_subnet.example.arn | ||
+ | resource_share_arn = aws_ram_resource_share.example.arn | ||
+ | } | ||
+ | |||
+ | # AWS resources shared via Resource Access Manager can take a few seconds to | ||
+ | # propagate across AWS accounts after RAM returns a successful association. | ||
+ | resource "time_sleep" "ram_resource_propagation" { | ||
+ | create_duration = "60s" | ||
+ | |||
+ | triggers = { | ||
+ | # This sets up a proper dependency on the RAM association | ||
+ | subnet_arn = aws_ram_resource_association.example.resource_arn | ||
+ | subnet_id = aws_subnet.example.id | ||
+ | } | ||
+ | } | ||
+ | |||
+ | resource "aws_db_subnet_group" "example" { | ||
+ | name = "example" | ||
+ | |||
+ | # Read the Subnet identifier "through" the time_sleep resource to ensure a | ||
+ | # proper dependency and that both will change together. | ||
+ | subnet_ids = [time_sleep.ram_resource_propagation.triggers["subnet_id"]] | ||
+ | } | ||
+ | </pre> | ||
Revision as of 10:29, 7 February 2024
https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep
resource "aws_ram_resource_association" "example" { resource_arn = aws_subnet.example.arn resource_share_arn = aws_ram_resource_share.example.arn } # AWS resources shared via Resource Access Manager can take a few seconds to # propagate across AWS accounts after RAM returns a successful association. resource "time_sleep" "ram_resource_propagation" { create_duration = "60s" triggers = { # This sets up a proper dependency on the RAM association subnet_arn = aws_ram_resource_association.example.resource_arn subnet_id = aws_subnet.example.id } } resource "aws_db_subnet_group" "example" { name = "example" # Read the Subnet identifier "through" the time_sleep resource to ensure a # proper dependency and that both will change together. subnet_ids = [time_sleep.ram_resource_propagation.triggers["subnet_id"]] }
See also
Advertising: