Quantcast
Channel: Terraform - HashiCorp Discuss
Viewing all articles
Browse latest Browse all 11426

Depends on resource attributes that cannot be determined until apply

$
0
0

I’m trying to deploy a bastion conditional on bastion being enabled or bastion IP definition.

From terraform.tfvars:

bastion_ip = "1.2.3.4"

It fails terraform plan:

│ Error: Invalid count argument
│
│   on modules/platform/main.tf line 7, in resource "null_resource" "bastion":
│    7:         count = var.bastion_enabled || length(var.bastion_ip) > 0 ? 1 : 0
│
│ The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target argument to first
│ apply only the resources that the count depends on.

I have set an IP so unsure why it must fail; can I work around this?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 11426

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>