Skip to content

Commit 7f3c7ed

Browse files
committed
Fix updating JWKS service accounts
If we try to update a JWKS service account with the same Issuer/Subject, we get an error that the Issuer/Subject must be unique across all service accounts. I think this is a bug in TLSPC (Issuer/Subject are still unique if we're acting on the same service account). Workaround this by only providing the Issuer/Subject to the update payload if they have changed.
1 parent eb28ec9 commit 7f3c7ed

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

internal/provider/service_account_resource.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,13 @@ func (r *serviceAccountResource) Update(ctx context.Context, req resource.Update
258258
return
259259
}
260260
serviceAccount.JwksURI = plan.JwksURI.ValueString()
261-
serviceAccount.IssuerURL = plan.IssuerURL.ValueString()
261+
if state.IssuerURL.ValueString() != plan.IssuerURL.ValueString() {
262+
serviceAccount.IssuerURL = plan.IssuerURL.ValueString()
263+
}
262264
serviceAccount.Audience = plan.Audience.ValueString()
263-
serviceAccount.Subject = plan.Subject.ValueString()
265+
if state.Subject.ValueString() != plan.Subject.ValueString() {
266+
serviceAccount.Subject = plan.Subject.ValueString()
267+
}
264268
serviceAccount.AuthenticationType = "rsaKeyFederated"
265269

266270
apps := []string{}

0 commit comments

Comments
 (0)