fix: github_rest_api data source always returns header and body as null#2110
Merged
kfcampbell merged 4 commits intointegrations:mainfrom Jan 22, 2024
Merged
Conversation
Contributor
Author
|
Tests: |
1 task
kfcampbell
approved these changes
Jan 22, 2024
Contributor
kfcampbell
left a comment
There was a problem hiding this comment.
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!
avidspartan1
pushed a commit
to avidspartan1/terraform-provider-github
that referenced
this pull request
Feb 5, 2024
…ll (integrations#2110) * Enhance tests * Marshal body and headers to JSON string * Update documentation to reference JSON string --------- Co-authored-by: Keegan Campbell <me@kfcampbell.com>
Contributor
This was referenced Feb 16, 2024
Contributor
Author
|
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": []
}
]
}
],
|
Contributor
|
See my pr #2152 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.