Skip to content
This repository has been archived by the owner on Apr 30, 2021. It is now read-only.

Commit

Permalink
Workaround issue with calculating length of computed resources
Browse files Browse the repository at this point in the history
We have to pass the number of subnets around (rather than dynamically
counting them) because of an issue in Terraform:

hashicorp/terraform#12570

Without this we see the following error message when `terraform
apply`ing from scratch:

```
Error: Error refreshing state: 1 error(s) occurred:

* module.hsm.data.aws_subnet.vpc: data.aws_subnet.vpc: value of 'count'
cannot be computed
```

If the cluster has already been spun up and the HSM module included at a
later date then the Terraform would apply cleanly in its current state.

This may be end up being resolved in Terraform 0.12 when it is released.
  • Loading branch information
samcrang committed Mar 1, 2019
1 parent f569226 commit 15d3b93
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/gsp-cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ output "private-subnet-ids" {
value = ["${aws_subnet.cluster-private.*.id}"]
}

// Workaround for https://github.com/hashicorp/terraform/issues/12570
output "private-subnet-count" {
value = "${length(data.aws_availability_zones.all.names)}"
}

output "controller-instance-profile-name" {
value = "${module.k8s-cluster.controller-instance-profile-name}"
}
Expand Down

0 comments on commit 15d3b93

Please sign in to comment.