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

INFRA-2573: fix updating SSL certs #8

Merged
merged 7 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @hashicorp/terraform-devex
* @uchiru/platform-team
27 changes: 27 additions & 0 deletions internal/provider/l7resource_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,20 @@ func (r *l7resourceResource) Create(ctx context.Context, req resource.CreateRequ
)
return
}

var CustomSslKey, CustomSslCrt string
// Hack - servicepipe api doesn't support ssl cert params in response
if !plan.CustomSslKey.IsNull() || !plan.CustomSslKey.IsUnknown() {
CustomSslKey = plan.CustomSslKey.ValueString()
}

if !plan.CustomSslCrt.IsNull() || !plan.CustomSslCrt.IsUnknown() {
CustomSslCrt = plan.CustomSslCrt.ValueString()
}

respUpd.Data.Result.CustomSslKey = CustomSslKey
respUpd.Data.Result.CustomSslCrt = CustomSslCrt

// Convert from the API data model to the Terraform data model
plan = flatternL7ResourceModel(respUpd.Data.Result)
}
Expand Down Expand Up @@ -452,6 +466,18 @@ func (r *l7resourceResource) Update(ctx context.Context, req resource.UpdateRequ
return
}

// Hack - servicepipe api doesn't support ssl cert params in response
if !plan.CustomSslKey.IsNull() || !plan.CustomSslKey.IsUnknown() {
item.CustomSslKey = plan.CustomSslKey.ValueString()
}

if !plan.CustomSslCrt.IsNull() || !plan.CustomSslCrt.IsUnknown() {
item.CustomSslCrt = plan.CustomSslCrt.ValueString()
}

response.Data.Result.CustomSslKey = item.CustomSslKey
response.Data.Result.CustomSslCrt = item.CustomSslCrt

planOrigins := plan.Origins
plan = flatternL7ResourceModel(response.Data.Result)

Expand Down Expand Up @@ -837,6 +863,7 @@ func CheckingL7resourcePlanAttrIsNull(plan l7resourceResourceModel, item *l7reso
item.CustomSslCrt = plan.CustomSslCrt.ValueString()
update = true
}

if !plan.Forcessl.IsNull() || !plan.Forcessl.IsUnknown() {
item.Forcessl = int(plan.Forcessl.ValueInt64())
update = true
Expand Down
Loading