-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: github_rest_api data source always returns header and body as null #2110
fix: github_rest_api data source always returns header and body as null #2110
Conversation
Tests:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirming integration tests are passing for me as well. I'm comfortable releasing this as a minor change given the broken nature of the behavior before. We will be releasing #2091 soon though, so stay tuned!
…ll (integrations#2110) * Enhance tests * Marshal body and headers to JSON string * Update documentation to reference JSON string --------- Co-authored-by: Keegan Campbell <[email protected]>
EDIT: I took a look at your original issue 1776 and I see what you mean now, while my implementation works for the calls that return a map, it doesn't for calls that return an array. Good catch. hi @riezebosch - can you give some more info on what you're trying and seeing? If i try to use it, I get body populated correctly (on calls that don't fail with 404 or other things where body would be null). e.g. terraform {
required_providers {
github = {
source = "integrations/github"
version = "6.0.0"
}
}
}
provider "github" {}
data "github_rest_api" "test" {
endpoint = "repos/integrations/terraform-provider-github/git/refs/heads/main"
} gives me in state, trimmed for brevity: "resources": [
{
"mode": "data",
"type": "github_rest_api",
"name": "test",
"provider": "provider[\"registry.terraform.io/integrations/github\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"body": "{\"node_id\":\"MDM6UmVmOTM0NDYwOTk6cmVmcy9oZWFkcy9tYWlu\",\"object\":{\"sha\":\"16872b724254fdddc3441c713b087cb4d7005f83\",\"type\":\"commit\",\"url\":\"https://api.github.com/repos/integrations/terraform-provider-github/git/commits/16872b724254fdddc3441c713b087cb4d7005f83\"},\"ref\":\"refs/heads/main\",\"url\":\"https://api.github.com/repos/integrations/terraform-provider-github/git/refs/heads/main\"}",
"code": 200,
"headers": "{\"Access-Control-Allow-Origin\":[\"*\"],\"Access-Control-Expose-Headers\" etc etc....",
"status": "200 OK"
},
"sensitive_attributes": []
}
]
}
],
|
See my pr #2152 |
Resolves #2109
Before the change?
After the change?
Pull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!
This is technically a breaking change as it changes the type of the attributes involved to strings rather than maps - however, as this would have almost never worked properly, i'm not sure how much breaking it would do.