Comments (8)
This feels like a redux of this recent core issue hashicorp/terraform#30823 and pull request hashicorp/terraform#30830 -- it seems valuable to raise an issue upstream to see if Terraform core can actually ignore data source prior state in this situation, if its being consulted for plan generation.
from terraform-provider-http.
I was able to create a minimal test case for this.
It only happens if the deprecated body
attribute has still been used in the last apply with terraform-provider-http 2.x.
If you then upgrade to 3.0.0, it will fail with:
╷
│ Error: Unsupported attribute
│
│ on main.tf line 15, in resource "local_file" "this":
│ 15: content = data.http.this.body
│
│ This object has no argument, nested block, or exported attribute named "body".
Workaround: Switch to using response_body
prior to upgrading to terraform-provider-http 3.
Test case:
terraform {
required_providers {
http = {
source = "hashicorp/http"
version = "<3" # comment after first apply, run terrform init -upgrade, change body to response_body and apply again
}
}
}
data "http" "this" {
url = "https://www.hashicorp.com"
}
resource "local_file" "this" {
content = data.http.this.body
filename = "${path.module}/hashicorp.com.html"
}
I'll close this issue.
from terraform-provider-http.
By the way, there is no concept of state upgrades for data sources. There is only the UpgradeResourceState
RPC that is used with managed resources. The prior data source state is only supposed to be "informative" for plan generation.
from terraform-provider-http.
from terraform-provider-http.
I'm looking into this. Will try to create a PR today.
from terraform-provider-http.
Hi @pascal-hofmann sorry you ran into trouble here.
Could you possibly post a complete example of the terraform code you are using along with the version of the http
provider that you are/were using prior to upgrading to v3.0.0
?
Are you trying to use the body
attribute somewhere in your configuration?
Reason I ask is that the body
attribute has been removed in v3.0.0
and replaced by response_body
so I'm wondering if this is part of the issue?
from terraform-provider-http.
This is the issue. data resources are also persisted to state. When the schema changes, a state upgrader is required. I'm currently working on a PR. I'm just getting used to the new framework instead of sdk.
from terraform-provider-http.
@bendbennett I think currently the framework does not support state upgraders for data sources. :(
@bflad Do you have an idea, how to handle this case?
In the meantime I think I'll pin the provider version to 2. (I don't want to fix the state manually, because we have a lot of these data sources in a lot of states.)
from terraform-provider-http.
Related Issues (20)
- Support for application/samlmetadata+xml HOT 1
- GET not following 307 redirects HOT 1
- Allow specifying the expected Content-Type, to hide the warning HOT 3
- GitHub Actions - deprecated warnings found - action required! HOT 2
- Warning: Missing version constraint for provider "http" in "required_providers" (terraform_required_providers) HOT 2
- Warning: Response body is not recognized as UTF-8 even if response_body is not used HOT 3
- Files are stored in the state file multiple times making the state huge HOT 6
- Failure behaviour HOT 1
- Feature: Add HTTPS Resource Request HOT 5
- Unable to get proper response from Auth0 get token call HOT 5
- Host header is not sent with request_headers HOT 6
- Update Go Module to Go 1.20 Minimum HOT 1
- Add support for rate limiting HOT 5
- Allow reuse of HTTP connection
- Documentation indicates that only text/* or application/json response content types are supported HOT 1
- Intermittent "Missing pending object in plan" error HOT 4
- Add option to specify data result as sensitive
- Error making requests to Cloudflare HOT 8
- Log requests when `TF_LOG=debug`
- Support resending headers on redirects
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-http.