-
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 new auth0_organization_connection resource #253
Conversation
Codecov Report
@@ Coverage Diff @@
## main #253 +/- ##
==========================================
+ Coverage 83.33% 83.36% +0.03%
==========================================
Files 37 38 +1
Lines 6985 7088 +103
==========================================
+ Hits 5821 5909 +88
- Misses 924 935 +11
- Partials 240 244 +4
Continue to review full report at Codecov.
|
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 aid with reviewing.
@@ -61,6 +61,9 @@ func newOrganization() *schema.Resource { | |||
"connections": { | |||
Type: schema.TypeSet, | |||
Optional: true, | |||
Computed: true, |
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.
Sadly we need to mark this now as computed, otherwise if we use the newly introduced auth0_organization_connection
to add a new connection, when terraform performs a refresh the auth0_organization
resource will see that a new connection was added "out-of-bound" and it will try to remove it, but the new resource will try to add it again, causing an infinite loop.
We're marking this however as well as deprecated and it will get removed in the future, once everyone ports over to the new way of adding and removing connections on orgs, through the new resource.
auth0/resource_auth0_organization.go
Outdated
Metadata: &metadata, | ||
} | ||
|
||
if d.HasChange("metadata") { |
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.
While implementing the new resource and adding minimal tests for it, it was spotted that we need a HasChange over here when we first create the org, otherwise if we don't have the metadata the first time we create the org it will get sent as "null" and the API doesn't accept that.
"name": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The name of the enabled connection.", | ||
}, | ||
"strategy": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The strategy of the enabled connection.", | ||
}, | ||
}, | ||
} |
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.
Proper example of readonly properties that might be useful to have.
@@ -0,0 +1,45 @@ | |||
--- |
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.
This was generated with the make docs-gen RESOURCE=organization_connection
command.
ca20288
to
81c6e8e
Compare
auth0/resource_auth0_organization.go
Outdated
@@ -61,6 +61,9 @@ func newOrganization() *schema.Resource { | |||
"connections": { | |||
Type: schema.TypeSet, | |||
Optional: true, | |||
Computed: true, | |||
Deprecated: "This attribute will be removed in the future. " + |
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.
Deprecated: "This attribute will be removed in the future. " + | |
Deprecated: "Management of organizations through this property has been deprecated in favor of the `auth0_organization_connection` resource and will be deleted in future versions. It is advised to migrate all managed organization connections to the new resource type.", |
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.
👍
0c9c8a3
to
89b13b5
Compare
Description
Splitting the connections out of the organization resource into its own resource, however we keep the old connection sets on the organization until folks have enough time to migrate over. This is done to simplify the internal logic and improve DX.
Checklist
Note: Checklist required to be completed before a PR is considered to be reviewable.
Auth0 Code of Conduct
Auth0 General Contribution Guidelines
Changes include test coverage?
Does the description provide the correct amount of context?
Have you updated the documentation?
Is this code ready for production?