这是indexloc提供的服务,不要输入任何密码
Skip to content

[Trusted IPs] Support empty note #188

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

Merged
merged 2 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions client/deployment_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions vercel/data_source_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -82,7 +81,6 @@ resource "vercel_project" "test" {
addresses = [
{
value = "1.1.1.1"
note = "notey note"
}
]
deployment_type = "only_production_deployments"
Expand Down
8 changes: 6 additions & 2 deletions vercel/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
})
}

Expand Down Expand Up @@ -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{
Expand Down