-
Notifications
You must be signed in to change notification settings - Fork 188
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
chore: Migrates federated_settings_identity_provider to new auto-generated SDK #1808
Conversation
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.
moved all flatteners to this new file. Some of the flatteners are also used in federated_settings_org_config so I did not change those to new SDK. Instead, created new methods for the ones used by new SDK.
if !federationSettingsIDOk { | ||
return diag.FromErr(errors.New("federation_settings_id must be configured")) | ||
} | ||
// There is no available paginated method |
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.
as of now there is no way to paginate results in the new SDK
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.
Although the old SDK defined list options they were not used as the options are not present in the v1 API: https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v1/#tag/Federated-Authentication/operation/listIdentityProviders
Given that page_num
and items_per_page
are not being used, should we create a followup ticket to deprecate them?
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.
Makes sense to me. I can create the ticket
edit: Created the ticket: CLOUDP-221367
LGTM! Good to have a second look for this change |
...rvice/federatedsettingsidentityprovider/data_source_federated_settings_identity_providers.go
Show resolved
Hide resolved
@@ -201,7 +201,7 @@ func DataSource() *schema.Resource { | |||
} | |||
func dataSourceMongoDBAtlasFederatedSettingsIdentityProviderRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics { | |||
// Get client connection. | |||
conn := meta.(*config.MongoDBClient).Atlas | |||
connV2 := meta.(*config.MongoDBClient).AtlasV2 |
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.
As acceptance test for the resource and data sources are not being run in the CI, wanted to confirm if you were able to run them locally.
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 have run all acceptance tests locally successfully
...rnal/service/federatedsettingsidentityprovider/model_federated_settings_identity_provider.go
Outdated
Show resolved
Hide resolved
...rnal/service/federatedsettingsidentityprovider/model_federated_settings_identity_provider.go
Outdated
Show resolved
Hide resolved
@@ -11,13 +11,13 @@ import ( | |||
"github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion" | |||
"github.com/mongodb/terraform-provider-mongodbatlas/internal/config" | |||
"github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" | |||
matlas "go.mongodb.org/atlas/mongodbatlas" | |||
"go.mongodb.org/atlas-sdk/v20231115002/admin" | |||
) | |||
|
|||
func TestAccFedRSFederatedSettingsIdentityProvider_basic(t *testing.T) { |
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.
When do you plan to add migration tests? If planning to merge this to master right away we should add some as part of this PR and update in subsequent PRs
...rnal/service/federatedsettingsidentityprovider/model_federated_settings_identity_provider.go
Show resolved
Hide resolved
...l/service/federatedsettingsidentityprovider/resource_federated_settings_identity_provider.go
Outdated
Show resolved
Hide resolved
* `identity_provider_id` - (Required) Unique 20-hexadecimal digit string that identifies the IdP. | ||
* `identity_provider_id` - (Required) Unique 20-hexadecimal or 24-hexadecimal digit string that identifies the IdP. | ||
|
||
**WARNING:** Starting at terraform provider 1.16.0 the allowed format for `identity_provider_id` will only be 24-hexadecimal digit string. See more [here](../guides/1.15.0-upgrade-guide.html.markdown) |
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.
will create a draft of the upgrade guide in a follow up PR
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.
@Zuhairahmed your input for these changes in documentation would be appreciated.
@@ -58,4 +59,6 @@ Identity Provider **must** be imported before using federation_settings_id-idp_i | |||
$ terraform import mongodbatlas_federated_settings_identity_provider.identity_provider 6287a663c660f52b1c441c6c-0oad4fas87jL5Xnk1297 | |||
``` | |||
|
|||
**WARNING:** Starting from terraform provider version 1.16.0, to import Identity Provider, `id` will have to be used instead of `okta_idp_id`. See more [here](../guides/1.15.0-upgrade-guide.html.markdown) |
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.
will create a draft of the upgrade guide in a follow up PR
Severity: diag.Warning, | ||
Summary: "Warning: deprecated identity provider id", | ||
Detail: "Identity provider id value used will be deprecated. Please start using the new value.\n" + | ||
" Follow instructions here: https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/1.15.0-upgrade-guide", |
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.
@Zuhairahmed your input would be appreciated here
@@ -49,6 +49,7 @@ In addition to all arguments above, the following attributes are exported: | |||
### FederatedSettingsIdentityProvider | |||
|
|||
* `okta_idp_id` - Unique 20-hexadecimal digit string that identifies the IdP. | |||
* `id` - Unique 24-hexadecimal digit string that identifies the IdP. |
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.
Is this accurate? From my understanding the id of the resource is not modified, and continues to be de the encoded value of the federation_settings_id and okta_idp_id.
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.
you are right, the terraform state id continues to be de the encoded value of the federation_settings_id and okta_idp_id. But once users start using the new id
, terraform state id will be federation_settings_id and id encoded
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 do agree that if the users does an import command, the id
value of the resource with be the encoded value of federation_settings_id + identity provider id (both new and old format will be supported). However, my question is if this documentation of id
which was added is accurate, because the id value will still be an encoded value which I doubt users will be able to use.
...l/service/federatedsettingsidentityprovider/resource_federated_settings_identity_provider.go
Outdated
Show resolved
Hide resolved
@@ -58,4 +59,6 @@ Identity Provider **must** be imported before using federation_settings_id-idp_i | |||
$ terraform import mongodbatlas_federated_settings_identity_provider.identity_provider 6287a663c660f52b1c441c6c-0oad4fas87jL5Xnk1297 | |||
``` | |||
|
|||
**WARNING:** Starting from terraform provider version 1.16.0, to import Identity Provider, `id` will have to be used instead of `okta_idp_id`. See more [here](../guides/1.15.0-upgrade-guide.html.markdown) |
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 believe it might be hard for users to understand what id
is, might be better to rephrase to 24-hexadecimal digit string that identifies the IdP
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.
Done
…derated_settings_identity_provider.go Co-authored-by: Agustin Bettati <[email protected]>
Description
migrates federated_settings_identity_provider to new auto-generated SDK
Because a breaking change in the latest version of the federated settings API, some changes needed to be made to grant users a grace period to avoid breaking changes in next release:
Link to any related issue(s): https://jira.mongodb.org/browse/CLOUDP-220807
Type of change:
Required Checklist:
Further comments