Skip to content
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

Zitadel provider fails to upload images using resource "zitadel_label_policy" #152

Open
1 of 2 tasks
akinsella-socrate opened this issue Jan 23, 2024 · 6 comments
Open
1 of 2 tasks
Labels
bug Something isn't working

Comments

@akinsella-socrate
Copy link

Preflight Checklist

  • I could not find a solution in the documentation, the existing issues or discussions
  • I have joined the ZITADEL chat

Version

v1.0.5

ZITADEL Version

Any

Describe the problem caused by this bug

When configuring Zitadel provider with the jwt_profile_file parameter, file upload fails for images on zitadel_label_policy resource.

Configuration example of the Zitadel provider:

provider "zitadel" {
  domain           = "dev.example.org"
  port             = "443"
  jwt_profile_file = "./terraform-sa.json"
}

Resource example:

resource "zitadel_label_policy" "label_policy" {
  org_id                 = zitadel_org.org.id

  hide_login_name_suffix = true

  primary_color          = "#578CAC"
  background_color       = "#D2D7DF"
  warn_color             = "#CF2C17"
  font_color             = "#313946"

  primary_color_dark     = "#9FC8E0"
  background_color_dark  = "#434E60"
  warn_color_dark        = "#F2988C"
  font_color_dark        = "#E5EAF0"
  
  disable_watermark      = true
  set_active             = true

  logo_hash              = filemd5("resources/images/logo-light-square.jpeg")
  logo_path              = "resources/images/logo-light-square.jpeg"

  logo_dark_hash         = filemd5("resources/images/logo-dark-square.jpeg")
  logo_dark_path         = "resources/images/logo-dark-square.jpeg"

  icon_hash              = filemd5("resources/images/logo-light-square.jpeg")
  icon_path              = "resources/images/logo-light-square.jpeg"

  icon_dark_hash         = filemd5("resources/images/logo-dark-square.jpeg")
  icon_dark_path         = "resources/images/logo-dark-square.jpeg"

  # font_hash              = filemd5("resources/fonts/noto-sans.ttf")
  # font_path              = "resources/fonts/noto-sans.ttf"
}

Received error:

 Error: failed to upload logo: [{0 either 'jwt_profile_file' or 'jwt_profile_json' is required  []}]
│ 
│   with module.organizations.zitadel_label_policy.ares_label_policy,
│   on modules/organizations/ares.tf line 147, in resource "zitadel_label_policy" "ares_label_policy":
│  147: resource "zitadel_label_policy" "ares_label_policy" {
│ 

As a result configuration of images (Including their file upload) fails, not the configuration of colors and options.

To reproduce

Execute a terraform apply step with configuration described above

Screenshots

No response

Expected behavior

Should succeed with the file upload and creation/update of the related resource

Relevant Configuration

No response

Additional Context

There is, if not mistaken one line of code to change in file client.go to get it work. The fix has been tested successfully (Replacing official plugin with a compiled one based on the most recent main branch commit).

Following condition :

         else if jwtProfileFile != "" {
		options = append(options, zitadel.WithJWTProfileTokenSource(middleware.JWTProfileFromPath(jwtProfileFile)))
		keyPath = token
	}

should be changed to :

         else if jwtProfileFile != "" {
		options = append(options, zitadel.WithJWTProfileTokenSource(middleware.JWTProfileFromPath(jwtProfileFile)))
		keyPath = jwtProfileFile
	}

With keyPath set to jwtProfileFile, file upload of the image is successful.

@akinsella-socrate
Copy link
Author

I opened a pull request with the fix proposal for review: #153

@akinsella-socrate
Copy link
Author

There might be another issue related to zitadel_label_policy as it is not possible to upload font successfully as well, but this one might be related to another issue as it is reproducible for in UI as well (It is not possible to upload font in Brand configuration page at least in version 1.43.4 and 1.43.5).

@akinsella-socrate
Copy link
Author

There might be another issue related to zitadel_label_policy as it is not possible to upload font successfully as well, but this one might be related to another issue as it is reproducible for in UI as well (It is not possible to upload font in Brand configuration page at least in version 1.43.4 and 1.43.5).

This one is related to max size that is accepted. Many font have a size bigger than 512kb which is finally unrelated with the rest of the issue.

@hifabienne hifabienne moved this to 🏗 In progress in Product Management Feb 5, 2024
@davidkalosi
Copy link

when can we expect this to be released? the PR is already merged.

@steled
Copy link

steled commented May 3, 2024

Hi,

we are running into the same problem. Thx to @akinsella-socrate for the fix but as mentioned in the PR it is closed because the merge of main into your branch was missing.

Maybe you can open a new PR with updated branch, that would be totally helpful

@vs-gtadeu
Copy link

We are also affected by this issue and want to know when the fix will be released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🏗 In progress
Development

No branches or pull requests

4 participants