Comments (2)
Indeed, I've seen this same behaviour more than a year later, using version 1.0.0 of this provider
from terraform-provider-template.
Hi all,
The cause of this is actually in Terraform Core itself rather than in the provider. The issue is that depends_on
for data resources currently forces Terraform to always defer the data source read to apply time, since depends_on
doesn't give enough information for Terraform to know whether the resource is depending on an apply-time side-effect of the dependency. This limitation is captured in hashicorp/terraform#17034.
The workaround for now is to use implicit rather than explicit dependencies, which tells Terraform a specific attribute of the other object that is needed before the data resource can be processed and thus allows Terraform to recognize that it is safe to read it during the plan step. In this case this can be achieved by reading the bucket name through the other data resource, thus creating that dependency:
data "aws_s3_bucket_object" "archive" {
bucket = "${var.bucket}"
key = "${var.product}/${var.service}/${var.service}-${var.version}.zip"
}
data "template_file" "user_data" {
template = "${file("${path.module}/templates/userdata.ps1")}"
vars = {
bucket = "${data.aws_s3_bucket_object.archive.bucket}"
key = "${var.product}/${var.service}/${var.service}-${var.version}.zip"
service = "${var.service}"
version = "${var.version}"
}
}
To eventually resolve hashicorp/terraform#17034 in Terraform Core we intend to adjust the lifecycle of data sources slightly so that the steps can happen in the right order to allow depends_on
to work in a more useful way. That work has been on hold while we've been working on the 0.12 release but we will dig into some further design/prototyping for it afterwards.
from terraform-provider-template.
Related Issues (20)
- Template 2.0.0 tries to interpulate percent (%) signs followed by curly-braces {} HOT 3
- Breaking change in substitution in v2.0.0 HOT 1
- Extremely unprofessional backward incompatible release HOT 1
- The new 2.0.0 doesn't parse %${var} core HOT 6
- Make Terraform validate template_file on plan phase
- Feature request: Render variables in filenames in template_dir
- Template provider - Better error message at template parsing HOT 2
- Terraform template creating the wrong type of numbers HOT 5
- template_dir doesn't work on Terraform v0.12.4 HOT 2
- template_dir doesn't skip hidden files HOT 1
- [regression] provider-template fails rendering when template file has % in the content starting from v2.0.0 HOT 3
- go module uses invalid version HOT 4
- Passing Lists as Template Variables HOT 2
- template_dir can't handle subdirectories correctly on windows: open <filename>: The system cannot find the path specified.
- depends_on should wait for template_dir generation HOT 3
- Provider cannot be migrated to terraform-plugin-sdk as it uses `lang` pkg directly
- Terragrunt panic due to api body size. HOT 2
- Unsupported functions in template file HOT 1
- Changes from nearly a year ago not published
- Provider archived
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-template.