-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/aws - CloudFront custom_error_response fixes for missing #6382
provider/aws - CloudFront custom_error_response fixes for missing #6382
Conversation
- Omit custom_error_response response_* fields when not explicitly set via config for SDK call - Adding a test case to ensure that the response_error gets converted to an empty string properly, versus "0". (Thanks @vancluever) Fixes hashicorp#6342
@jrnt30 what issue dies this fix? I don't believe the linked one is correct :) |
@stack72 Sorry about that, updated. |
Nps :) Just want to make sure we link it back to the right bug |
er.ResponseCode = aws.String(strconv.Itoa(v.(int))) | ||
} else { | ||
er.ResponseCode = aws.String("") |
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.
Do we actually want to send an empty string here or just omit it from the request completely?
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.
We do. If the element is missing AWS will error out unless they are present (and in our case empty).
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.
@stack72, as @jrnt30 mentioned, this is actually necessary, because the attribute is TypeInt
, but the API and SDK expect string
. There's a breakdown in the conversion between @jrnt30 in the referenced issue.
The reasoning for keeping response_code
as a TypeInt
is three-fold:
- It's the HTTP response code that needs to be sent back (and hence can only be int)
- It's that way in CloudFormation (which is what I was using as my reference implementation as much as possible)
cloudfront.CustomErrorResponse.ErrorCode
(the incoming error code) is*int64
, so it's kind of odd that this would be a*string
.
As such, we have to set this to ""
, as the zero value of int
, 0
, converts to "0"
with strconv.Itoa()
, versus an empty string.
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.
Got it! Just had to check :)
Currently running the tests on this (they take a long time!) - will post the results when they are done |
@stack72 yeah, if you are testing manually, you can set |
Just a FYI, as the tests were running I just saw this error:
ok end of run and 2 tests fail - please can you have a look at these |
Thank you...There will be another, somehow I reversed the names when On Wed, Apr 27, 2016 at 5:22 PM, Paul Stack notifications@github.com
|
|
thanks so much for fixing this up! This LGTM now :) Paul |
…shicorp#6382) * provider/aws - CloudFront custom_error_response fixes for missing - Omit custom_error_response response_* fields when not explicitly set via config for SDK call - Adding a test case to ensure that the response_error gets converted to an empty string properly, versus "0". (Thanks @vancluever) Fixes hashicorp#6342 * - Fixing ACC test case resource names
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
SDK call
to an empty string properly, versus "0". (Thanks @vancluever)
Fixes #6324