Skip to content

Commit a9d6d0e

Browse files
authored
adds code to prevent attaching auth policy for service oauth apps (#2403)
1 parent dccf1db commit a9d6d0e

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
The Terraform Okta provider is a plugin for Terraform that allows for the full lifecycle management of Okta resources.
1919
This provider is maintained internally by the Okta development team.
2020

21-
### WARNING
22-
We're working on releasing of the okta-terraform-provider v6.0.0, which will introduce support for managing a broader range of Okta resources beyond just management-related ones. Following that, we'd be deprecating the v5 versions of the okta-terraform-provider.
21+
> [!CAUTION]
22+
> We're working on releasing of the okta-terraform-provider v6.0.0, which will introduce support for managing a broader range of Okta resources beyond just management-related ones. Following that, we'd be deprecating the v5 versions of the okta-terraform-provider.
2323
2424
## Examples
2525

@@ -30,6 +30,7 @@ in form of raw markdown files.
3030

3131
# Development Environment Setup
3232

33+
3334
The sections below will guide you through the requirements, upgrading, getting started, building with and contributing to
3435
the Okta Terraform Provider.
3536

docs/resources/app_oauth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ resource "okta_app_oauth" "example" {
7171
- `admin_note` (String) Application notes for admins.
7272
- `app_links_json` (String) Displays specific appLinks for the app. The value for each application link should be boolean.
7373
- `app_settings_json` (String) Application settings in JSON format
74-
- `authentication_policy` (String) The ID of the associated app_signon_policy. If this property is removed from the application the default sign-on-policy will be associated with this application. We will be stop attaching authentication_policy for applications of type `SERVICE` in the upcoming release.
74+
- `authentication_policy` (String) The ID of the associated app_signon_policy. If this property is removed from the application the default sign-on-policy will be associated with this application. From now on, there is no need to attach authentication_policy for applications of type `SERVICE` in the upcoming release.
7575
- `auto_key_rotation` (Boolean) Requested key rotation mode. If
7676
auto_key_rotation isn't specified, the client automatically opts in for Okta's
7777
key rotation. You can update this property via the API or via the administrator

okta/services/idaas/resource_okta_app_oauth.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ other arguments that changed will be applied.`,
401401
Type: schema.TypeString,
402402
Optional: true,
403403
Computed: true,
404-
Description: `The ID of the associated app_signon_policy. If this property is removed from the application the default sign-on-policy will be associated with this application. We will be stop attaching authentication_policy for applications of type SERVICE in the upcoming release`,
404+
Description: `The ID of the associated app_signon_policy. If this property is removed from the application, the default sign-on-policy will be associated with this application. From now on, there is no need to attach authentication_policy for applications of type SERVICE`,
405405
},
406406
"jwks_uri": {
407407
Type: schema.TypeString,
@@ -478,9 +478,11 @@ func resourceAppOAuthCreate(ctx context.Context, d *schema.ResourceData, meta in
478478
if err != nil {
479479
return diag.Errorf("failed to update groups claim for an OAuth application: %v", err)
480480
}
481-
err = createOrUpdateAuthenticationPolicy(ctx, d, meta, app.Id)
482-
if err != nil {
483-
return diag.Errorf("failed to set authentication policy for an OAuth application: %v", err)
481+
if d.Get("type") != "service" {
482+
err = createOrUpdateAuthenticationPolicy(ctx, d, meta, app.Id)
483+
if err != nil {
484+
return diag.Errorf("failed to set authentication policy for an OAuth application: %v", err)
485+
}
484486
}
485487
return resourceAppOAuthRead(ctx, d, meta)
486488
}

0 commit comments

Comments
 (0)