diff --git a/client/deployment_protection.go b/client/deployment_protection.go index bc59c43d..c78d878d 100644 --- a/client/deployment_protection.go +++ b/client/deployment_protection.go @@ -13,8 +13,8 @@ type PasswordProtectionWithPassword struct { } type TrustedIpAddress struct { - Value string `json:"value"` - Note string `json:"note"` + Value string `json:"value"` + Note *string `json:"note,omitempty"` } type TrustedIps struct { diff --git a/vercel/data_source_project_test.go b/vercel/data_source_project_test.go index 34234140..93b040f7 100644 --- a/vercel/data_source_project_test.go +++ b/vercel/data_source_project_test.go @@ -31,7 +31,6 @@ func TestAcc_ProjectDataSource(t *testing.T) { resource.TestCheckResourceAttr("data.vercel_project.test", "automatically_expose_system_environment_variables", "true"), resource.TestCheckTypeSetElemNestedAttrs("data.vercel_project.test", "trusted_ips.addresses.*", map[string]string{ "value": "1.1.1.1", - "note": "notey note", }), resource.TestCheckResourceAttr("data.vercel_project.test", "trusted_ips.deployment_type", "only_production_deployments"), resource.TestCheckResourceAttr("data.vercel_project.test", "trusted_ips.protection_mode", "trusted_ip_required"), @@ -82,7 +81,6 @@ resource "vercel_project" "test" { addresses = [ { value = "1.1.1.1" - note = "notey note" } ] deployment_type = "only_production_deployments" diff --git a/vercel/resource_project.go b/vercel/resource_project.go index 1cf04cdf..4fe6466a 100644 --- a/vercel/resource_project.go +++ b/vercel/resource_project.go @@ -772,7 +772,7 @@ func (t *TrustedIps) toUpdateProjectRequest() *client.TrustedIps { for _, address := range t.Addresses { addresses = append(addresses, client.TrustedIpAddress{ Value: address.Value.ValueString(), - Note: address.Note.ValueString(), + Note: address.Note.ValueStringPointer(), }) } @@ -967,9 +967,13 @@ func convertResponseToProject(ctx context.Context, response client.ProjectRespon if response.TrustedIps != nil { var addresses []TrustedIpAddress for _, address := range response.TrustedIps.Addresses { + var note = types.StringNull() + if address.Note != nil { + note = types.StringValue(*address.Note) + } addresses = append(addresses, TrustedIpAddress{ Value: types.StringValue(address.Value), - Note: types.StringValue(address.Note), + Note: note, }) } tip = &TrustedIps{