-
Notifications
You must be signed in to change notification settings - Fork 25
Description
I'm trying to get this working and I love the idea! Its something that terraform should try and deal with but sadly just ignores the problem!
Couple of issues I have run into and wondering if you had solved.
This line
bootstrap = "${terraform.workspace == "base" ? 1 : 0}"
means that all other resources would need essentially the inverse of this should you ever want to go back to the base workspace and add things after bootstrapping and uploading the state.
Otherwise when switching from your other workspace to base terraform would then try to apply all of your other resources into the base workspace. Which probably isn't desired..
I presume you would work around this by never touching this workspace again once bootstrapped.
The other one is a couple of issues with the data resources not being excluded by the !bootstrap logic above.. Otherwise, they show up as issues in other workspaces
data "template_file" "operator_arn" {
count = "${length(var.operators)}"
template = "\"$${arn}\""
vars {
arn = "${element(data.aws_iam_user.operators.*.arn, count.index)}"
}
}
needs to become
data "template_file" "operator_arn" {
count = "${var.bootstrap ? length(var.operators) : 0}"
template = "\"$${arn}\""
vars {
arn = "${element(data.aws_iam_user.operators.*.arn, count.index)}"
}
}