cloudposse / terraform-aws-efs-backup

Terraform module designed to easily backup EFS filesystems to S3 using DataPipeline
https://cloudposse.com/accelerate
Apache License 2.0
43 stars 33 forks source link

Fix TF cycle error #10

Closed aknysh closed 6 years ago

aknysh commented 6 years ago

What

Why

osterman commented 6 years ago

Fascinating! We're using this module already, so maybe is due to newer versions of TF.

osterman commented 6 years ago

provider "aws" needs to be used from a top-level module. This module is a lower-level module provider "aws" causes cycles in terraform plan and terraform apply

Actually, this is the wrong conclusion. The regression was introduced by https://github.com/cloudposse/terraform-aws-efs-backup/commit/03a667bc12ead9084372dc5b84c5435ee64339cf#diff-7a370d8342e7203b805911c92454f0f4R6

The problem is that the aws_region data source depends on the provider data source. The provider resource is setting the region of the aws_region data source. Thus there's a catch 22 (cycle).

osterman commented 6 years ago

It should also be noted that both sides of a ternary are evaluated by terraform even if the condition is false. That's why the RHS of the ternary is executed and fails with the cycle error.