Skip to content

Commit

Permalink
Fix issue with git CredentialType empty when flatten
Browse files Browse the repository at this point in the history
  • Loading branch information
HuyPhanNguyen committed Aug 19, 2024
1 parent ff70090 commit 33362e5
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions octopusdeploy_framework/resource_project_expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ func expandGitLibraryPersistenceSettings(ctx context.Context, model gitLibraryPe

return projects.NewGitPersistenceSettings(
model.BasePath.ValueString(),
&credentials.Reference{
ID: model.GitCredentialID.ValueString(),
},
credentials.NewReference(model.GitCredentialID.ValueString()),
model.DefaultBranch.ValueString(),
protectedBranches,
gitUrl,
Expand All @@ -159,14 +157,12 @@ func expandGitUsernamePasswordPersistenceSettings(ctx context.Context, model git
var protectedBranches []string
model.ProtectedBranches.ElementsAs(ctx, &protectedBranches, false)

usernamePasswordCredential := credentials.NewUsernamePassword(
model.Username.ValueString(),
core.NewSensitiveValue(model.Password.ValueString()),
)

return projects.NewGitPersistenceSettings(
model.BasePath.ValueString(),
usernamePasswordCredential,
credentials.NewUsernamePassword(
model.Username.ValueString(),
core.NewSensitiveValue(model.Password.ValueString()),
),
model.DefaultBranch.ValueString(),
protectedBranches,
gitUrl,
Expand All @@ -180,7 +176,7 @@ func expandGitAnonymousPersistenceSettings(ctx context.Context, model gitAnonymo

return projects.NewGitPersistenceSettings(
model.BasePath.ValueString(),
&credentials.Anonymous{},
credentials.NewAnonymous(),
model.DefaultBranch.ValueString(),
protectedBranches,
gitUrl,
Expand Down

0 comments on commit 33362e5

Please sign in to comment.