-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add custom_client_ip_header and tls_policy to custom_domain resource #335
Conversation
So I'm trying to record some new http interactions and I'm facing a couple of problems:
|
Hey @cv711 👋🏻 thanks for the contribution! ⭐ I'll be able to help get this in the right place tomorrow, no worries about the conflicts either. If I can push to your branch I'll fix them as well. |
9038dd1
to
10196d2
Compare
Hey @cv711, I set this branch to draft mode while we get this in the right place. |
10196d2
to
7bc0cd3
Compare
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.
Adding a few comments to ease up reviewing, also to give you an overview of all the extra changes that were still needed @cv711 . Hope it helps for future contributions from your part! ☘️ Looking forward to reviewing some more of your work:)
@@ -18,6 +17,7 @@ func newCustomDomain() *schema.Resource { | |||
return &schema.Resource{ | |||
CreateContext: createCustomDomain, | |||
ReadContext: readCustomDomain, | |||
UpdateContext: updateCustomDomain, |
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're adding an update command as well because the custom_client_ip_header
and tls_policy
fields can be updated without recreating the custom domain entity.
Type: schema.TypeString, | ||
Optional: true, | ||
ValidateFunc: validation.StringInSlice([]string{ | ||
"cf-connecting-ip", "x-forwarded-for", "true-client-ip", "", |
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're adding as well validation as this field can only have certain values.
Description: "The HTTP header to fetch the client's IP address. " + | ||
"Cannot be set on auth0_managed domains.", | ||
}, | ||
"tls_policy": { |
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're adding this field as well for completeness as the PATCH endpoint accepts it as well.
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.
I was planning to add this field in my next PR but good to have them both here!
if os.Getenv("AUTH0_DOMAIN") != recorder.RecordingsDomain { | ||
t.Skip() | ||
} | ||
const testAccCreateSelfManagedCustomDomain = ` |
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.
Refactoring the tests so they're covering more cases.
@@ -47,35 +46,135 @@ func init() { | |||
}) | |||
} | |||
|
|||
func TestAccCustomDomain(t *testing.T) { | |||
if os.Getenv("AUTH0_DOMAIN") != recorder.RecordingsDomain { |
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.
It turns out we didn't really need to run these tests only on the predefined recordings, we can run them on the live tenant on demand as well without anything breaking as we're not going through the verification.
} | ||
|
||
if d.IsNewResource() { | ||
customDomain.Domain = value.String(config.GetAttr("domain")) |
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 still wanna make sure the domain and type can only be set on a new resource but are not getting sent on the PATCH.
@cv711 If you wanna test this as well on your side before we merge this and cut a release you can use the e.g.
|
🚀 all good from my side! Thank you very much for your help! |
🔧 Changes
This PR is exposing the
custom_client_ip_header
option for custom domains🔬 Testing
📝 Checklist