You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I actually found a workaround last week just by clicking around on the response link.
So the 307 redirect response contains the redirect url in the <A HREF="...url_is_here...">...</A> tag.
It will be valid for a few seconds (something like 5 seconds).
So now we can just extract this url and then put a second http data-source around it and you are good to go.
so this would be the final code assuming the variables are already set up:
# first data source that will lead to the redirect responsedata"http""get_sheet" {
url=format("%s%s/pub?gid=%s&output=csv", var.gsheet.base_url, var.gsheet.pub_id, var.gsheet.gid)
method="GET"request_headers={
Accept ="text/csv"
}
}
# a locals variable that extracts the redirect url from the first responselocals {
sheet_redirect_url=replace(regex("<A HREF=\"(.+)\">here</A>", data.http.get_sheet_normal_unique.response_body)[0], "&", "&")
}
# output just to see if the url looks goodoutput"sheet_extracted_redirect_url" {
value=local.sheet_redirect_url
}
# second data source to get the actual csv (or whatever data)data"http""get_sheet_redirected" {
url=local.sheet_redirect_urlmethod="GET"request_headers={
Accept ="text/csv"
}
}
# output to see the dataoutput"sheet_response_redirected" {
value=data.http.get_sheet_redirected.response_body
}
Terraform CLI and Provider Versions
Terraform v1.4.6
on darwin_amd64
Terraform Configuration
Expected Behavior
csv data should be output.
Actual Behavior
a 307 redirect response html is output.
Steps to Reproduce
terraform plan
How much impact is this issue causing?
High
Logs
No response
Additional Information
public link of the google sheet:
sheet
With the Location parameter set (-L) the 307 redirect will success.
A curl -Li will output:
Code of Conduct
The text was updated successfully, but these errors were encountered: