Skip to content

Conversation

@ajilty
Copy link

@ajilty ajilty commented Oct 17, 2025

Description

This PR adds support for uploading application logos using base64-encoded data instead of requiring local file paths. This enhancement provides better flexibility for automation and CI/CD workflows where managing local files is cumbersome.

Changes

Core Implementation

  • New Field: Added logo_base64 field to all app resource schemas
  • Validation: Created LogoBase64IsValid() function to validate base64 data and enforce 1MB size limit
  • SDK Method: Implemented UploadApplicationLogoFromBase64() in sdk/v2_application.go
  • Conflict Resolution: Made logo and logo_base64 mutually exclusive using ConflictsWith

Resources Updated

All 9 app resources now support logo_base64:

  • okta_app_bookmark
  • okta_app_auto_login
  • okta_app_basic_auth
  • okta_app_shared_credentials
  • okta_app_swa
  • okta_app_three_field
  • okta_app_secure_password_store
  • okta_app_oauth
  • okta_app_saml

Documentation

  • Auto-generated documentation includes the new logo_base64 field for all app resources
  • Clear descriptions and examples provided

Usage Example

Before (File Path):

resource "okta_app_bookmark" "example" {
  label = "Example App"
  url   = "https://example.com"
  logo  = "/path/to/logo.png"
}

After (Base64):

resource "okta_app_bookmark" "example" {
  label       = "Example App"
  url         = "https://example.com"
  logo_base64 = filebase64("/path/to/logo.png")
}

Testing

  • ✅ Code compiles successfully with go build
  • ✅ Code formatted with go fmt
  • ✅ Documentation generated with make docs
  • ⚠️ Acceptance tests: Best effort implementation - would appreciate help running full test suite

Checklist

Following the contributing guidelines:

  • Well-formed code following Go conventions
  • Code formatted with go fmt
  • Documentation updates included (auto-generated)
  • Error handling with proper context messages
  • Proper rollback on upload failure
  • Uses existing SDK patterns and validation functions
  • Maintains backward compatibility
  • Mutually exclusive fields using ConflictsWith
  • 1MB size limit enforced (matches existing logo field)

Benefits

  1. Better CI/CD Integration: No need to manage temporary files in automated pipelines
  2. Cleaner Workflows: Use Terraform's filebase64() function directly
  3. Consistency: Similar pattern to other providers (e.g., AWS, Azure)
  4. Backward Compatible: Existing logo field continues to work as before

Notes

This is my first contribution to the Okta Terraform provider. I've done my best to follow all contributing guidelines and would appreciate any feedback or suggestions for improvements!

This commit adds support for setting application logos using base64-encoded
images as an alternative to file paths.

Changes:
- Added LogoBase64IsValid() validation function in okta/utils/utils.go
  to validate base64 encoding and enforce 1MB decoded size limit
- Added UploadApplicationLogoFromBase64() method in sdk/v2_application.go
  to handle base64 logo uploads via multipart form data
- Updated base application schema in okta/services/idaas/app.go:
  - Added logo_base64 field with ConflictsWith constraint
  - Modified handleAppLogo() to support both logo and logo_base64
- Updated all 9 application resource files to detect changes in both
  logo and logo_base64 fields with proper rollback handling:
  - resource_okta_app_bookmark.go
  - resource_okta_app_auto_login.go
  - resource_okta_app_basic_auth.go
  - resource_okta_app_shared_credentials.go
  - resource_okta_app_swa.go
  - resource_okta_app_three_field.go
  - resource_okta_app_secure_password_store.go
  - resource_okta_app_oauth.go
  - resource_okta_app_saml.go

The logo_base64 and logo fields are mutually exclusive via ConflictsWith.
@github-actions github-actions bot requested a review from pranav-okta October 17, 2025 17:51
@ajilty ajilty marked this pull request as draft October 17, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant