Skip to content

Commit

Permalink
Merge pull request #34418 from hashicorp/b-aws_sagemaker_domain.canva…
Browse files Browse the repository at this point in the history
…s_app_settings

r/aws_sagemaker_user_profile: Fix crash
  • Loading branch information
ewbankkit authored Nov 15, 2023
2 parents 648f3d7 + 11d78fe commit 6df0cc3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .changelog/34418.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_sagemaker_user_profile: Change `default_user_settings.canvas_app_settings.identity_provider_oauth_settings` from TypeSet to TypeList, preventing `interface conversion: interface {} is *schema.Set, not []interface {}` panics
```
26 changes: 19 additions & 7 deletions internal/service/sagemaker/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1207,13 +1207,25 @@ func expandCanvasAppSettings(l []interface{}) *sagemaker.CanvasAppSettings {

m := l[0].(map[string]interface{})

config := &sagemaker.CanvasAppSettings{
IdentityProviderOAuthSettings: expandIdentityProviderOAuthSettings(m["identity_provider_oauth_settings"].([]interface{})),
DirectDeploySettings: expandDirectDeploySettings(m["direct_deploy_settings"].([]interface{})),
KendraSettings: expandKendraSettings(m["kendra_settings"].([]interface{})),
ModelRegisterSettings: expandModelRegisterSettings(m["model_register_settings"].([]interface{})),
TimeSeriesForecastingSettings: expandTimeSeriesForecastingSettings(m["time_series_forecasting_settings"].([]interface{})),
WorkspaceSettings: expandWorkspaceSettings(m["workspace_settings"].([]interface{})),
config := &sagemaker.CanvasAppSettings{}

if v, ok := m["direct_deploy_settings"].([]interface{}); ok {
config.DirectDeploySettings = expandDirectDeploySettings(v)
}
if v, ok := m["identity_provider_oauth_settings"].([]interface{}); ok {
config.IdentityProviderOAuthSettings = expandIdentityProviderOAuthSettings(v)
}
if v, ok := m["kendra_settings"].([]interface{}); ok {
config.KendraSettings = expandKendraSettings(v)
}
if v, ok := m["model_register_settings"].([]interface{}); ok {
config.ModelRegisterSettings = expandModelRegisterSettings(v)
}
if v, ok := m["time_series_forecasting_settings"].([]interface{}); ok {
config.TimeSeriesForecastingSettings = expandTimeSeriesForecastingSettings(v)
}
if v, ok := m["workspace_settings"].([]interface{}); ok {
config.WorkspaceSettings = expandWorkspaceSettings(v)
}

return config
Expand Down
2 changes: 1 addition & 1 deletion internal/service/sagemaker/user_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func ResourceUserProfile() *schema.Resource {
},
},
"identity_provider_oauth_settings": {
Type: schema.TypeSet,
Type: schema.TypeList,
Optional: true,
MaxItems: 20,
Elem: &schema.Resource{
Expand Down

0 comments on commit 6df0cc3

Please sign in to comment.