Created
November 13, 2018 00:44
-
-
Save holms/2b6e72068abcaacf898f66b052ed7d67 to your computer and use it in GitHub Desktop.
Terraform modules depends_on workaround
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# File fancy-app-module/variables.tf | |
variable depends_on { default = [], type = "list"} | |
# File my-app.tf | |
module "app" { | |
source = "modules/fancy-app-module" | |
# Wait for resources and associations to be created | |
depends_on = [ | |
"${aws_alb_target_group.app.arn}" | |
] | |
} | |
resource "aws_alb_target_group" "app" { | |
name = "app-group" | |
} | |
resource "aws_alb_listener" "front_end" { | |
# Association of default_action takes some time and | |
# if this action is required by you module, it's creation | |
# might fail due to async provisioning of the | |
# resources by terraform | |
default_action { | |
target_group_arn = "${aws_alb_target_group.app.id}" | |
type = "forward" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment