From 91135cb3e3dede8430694ce6586aa885e5f61268 Mon Sep 17 00:00:00 2001 From: Douglas Harcourt Parsons Date: Tue, 4 Mar 2025 21:09:47 +0000 Subject: [PATCH 1/5] interface{} -> any. Fix faulty import example --- client/access_group.go | 8 +++--- client/access_group_project.go | 8 +++--- client/alias.go | 6 ++-- client/custom_environment.go | 8 +++--- client/deploy_hooks.go | 4 +-- client/deployment.go | 28 +++++++++---------- client/dns_record.go | 2 +- client/edge_config.go | 10 +++---- client/edge_config_item.go | 6 ++-- client/edge_config_schema.go | 6 ++-- client/edge_config_token.go | 6 ++-- client/environment_variable.go | 10 +++---- client/file.go | 2 +- client/integrations.go | 6 ++-- client/log_drain.go | 6 ++-- client/microfrontend_group.go | 12 ++++---- client/microfrontend_group_membership.go | 10 +++---- client/must_marshal.go | 2 +- client/project.go | 16 +++++------ client/project_deployment_retention.go | 6 ++-- client/project_domain.go | 8 +++--- client/project_function_cpu.go | 2 +- client/project_member.go | 16 +++++------ ...protection_bypass_for_automation_update.go | 2 +- client/request.go | 6 ++-- client/shared_environment_variable.go | 10 +++---- client/team.go | 4 +-- client/team_member.go | 8 +++--- client/webhook.go | 6 ++-- docs/resources/team_member.md | 2 +- .../resources/vercel_team_member/import.sh | 2 +- vercel/data_source_access_group.go | 2 +- vercel/data_source_access_group_project.go | 2 +- vercel/data_source_alias.go | 2 +- vercel/data_source_attack_challenge_mode.go | 2 +- vercel/data_source_custom_environment.go | 2 +- vercel/data_source_deployment.go | 2 +- vercel/data_source_edge_config.go | 2 +- vercel/data_source_edge_config_item.go | 2 +- vercel/data_source_edge_config_schema.go | 2 +- vercel/data_source_edge_config_token.go | 2 +- vercel/data_source_log_drain.go | 2 +- vercel/data_source_microfrontend_group.go | 4 +-- ...a_source_microfrontend_group_membership.go | 4 +-- vercel/data_source_project.go | 2 +- ...ata_source_project_deployment_retention.go | 2 +- ...data_source_shared_environment_variable.go | 4 +-- vercel/resource_access_group.go | 10 +++---- vercel/resource_access_group_project.go | 10 +++---- vercel/resource_alias.go | 6 ++-- vercel/resource_attack_challenge_mode.go | 10 +++---- vercel/resource_custom_environment.go | 8 +++--- vercel/resource_deployment.go | 10 +++---- vercel/resource_dns_record.go | 8 +++--- vercel/resource_edge_config.go | 10 +++---- vercel/resource_edge_config_item.go | 8 +++--- vercel/resource_edge_config_schema.go | 10 +++---- vercel/resource_edge_config_token.go | 8 +++--- vercel/resource_firewall_bypass.go | 8 +++--- vercel/resource_firewall_config.go | 6 ++-- vercel/resource_integration_project_access.go | 6 ++-- vercel/resource_log_drain.go | 8 +++--- vercel/resource_microfrontend_group.go | 18 ++++++------ ...resource_microfrontend_group_membership.go | 14 +++++----- vercel/resource_project.go | 20 ++++++------- .../resource_project_deployment_retention.go | 10 +++---- vercel/resource_project_domain.go | 10 +++---- .../resource_project_environment_variable.go | 10 +++---- .../resource_project_environment_variables.go | 14 +++++----- vercel/resource_project_members.go | 6 ++-- .../resource_shared_environment_variable.go | 10 +++---- ...hared_environment_variable_project_link.go | 8 +++--- vercel/resource_team_config.go | 4 +-- vercel/resource_team_member.go | 6 ++-- vercel/resource_webhook.go | 6 ++-- vercel/validator_json_string.go | 2 +- 76 files changed, 265 insertions(+), 265 deletions(-) diff --git a/client/access_group.go b/client/access_group.go index 7ea8ce2f..06f731ab 100644 --- a/client/access_group.go +++ b/client/access_group.go @@ -23,7 +23,7 @@ func (c *Client) GetAccessGroup(ctx context.Context, req GetAccessGroupRequest) if c.teamID(req.TeamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(req.TeamID)) } - tflog.Info(ctx, "getting access group", map[string]interface{}{ + tflog.Info(ctx, "getting access group", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ @@ -57,7 +57,7 @@ func (c *Client) CreateAccessGroup(ctx context.Context, req CreateAccessGroupReq Name: req.Name, }, )) - tflog.Info(ctx, "creating access group", map[string]interface{}{ + tflog.Info(ctx, "creating access group", map[string]any{ "url": url, "payload": payload, }) @@ -92,7 +92,7 @@ func (c *Client) UpdateAccessGroup(ctx context.Context, req UpdateAccessGroupReq Name: req.Name, }, )) - tflog.Info(ctx, "updating access group", map[string]interface{}{ + tflog.Info(ctx, "updating access group", map[string]any{ "url": url, "payload": payload, }) @@ -119,7 +119,7 @@ func (c *Client) DeleteAccessGroup(ctx context.Context, req DeleteAccessGroupReq if c.teamID(req.TeamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(req.TeamID)) } - tflog.Info(ctx, "deleting access group", map[string]interface{}{ + tflog.Info(ctx, "deleting access group", map[string]any{ "url": url, }) return c.doRequest(clientRequest{ diff --git a/client/access_group_project.go b/client/access_group_project.go index 74e04b09..5f80e91f 100644 --- a/client/access_group_project.go +++ b/client/access_group_project.go @@ -35,7 +35,7 @@ func (c *Client) CreateAccessGroupProject(ctx context.Context, req CreateAccessG ProjectID: req.ProjectID, }, )) - tflog.Info(ctx, "creating access group project", map[string]interface{}{ + tflog.Info(ctx, "creating access group project", map[string]any{ "url": url, "payload": payload, }) @@ -63,7 +63,7 @@ func (c *Client) GetAccessGroupProject(ctx context.Context, req GetAccessGroupPr if c.teamID(req.TeamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(req.TeamID)) } - tflog.Info(ctx, "getting access group project", map[string]interface{}{ + tflog.Info(ctx, "getting access group project", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ @@ -98,7 +98,7 @@ func (c *Client) UpdateAccessGroupProject(ctx context.Context, req UpdateAccessG Role: req.Role, }, )) - tflog.Info(ctx, "updating access group project", map[string]interface{}{ + tflog.Info(ctx, "updating access group project", map[string]any{ "url": url, "payload": payload, }) @@ -126,7 +126,7 @@ func (c *Client) DeleteAccessGroupProject(ctx context.Context, req DeleteAccessG if c.teamID(req.TeamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(req.TeamID)) } - tflog.Info(ctx, "deleting access group project", map[string]interface{}{ + tflog.Info(ctx, "deleting access group project", map[string]any{ "url": url, }) return c.doRequest(clientRequest{ diff --git a/client/alias.go b/client/alias.go index 8b41f5d0..97705f0c 100644 --- a/client/alias.go +++ b/client/alias.go @@ -27,7 +27,7 @@ func (c *Client) CreateAlias(ctx context.Context, request CreateAliasRequest, de } payload := string(mustMarshal(request)) - tflog.Info(ctx, "creating alias", map[string]interface{}{ + tflog.Info(ctx, "creating alias", map[string]any{ "url": url, "payload": payload, }) @@ -62,7 +62,7 @@ func (c *Client) DeleteAlias(ctx context.Context, aliasUID string, teamID string url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "deleting alias", map[string]interface{}{ + tflog.Info(ctx, "deleting alias", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ @@ -88,7 +88,7 @@ func (c *Client) GetAlias(ctx context.Context, alias, teamID string) (r AliasRes if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "getting alias", map[string]interface{}{ + tflog.Info(ctx, "getting alias", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ diff --git a/client/custom_environment.go b/client/custom_environment.go index 53df075e..377c7639 100644 --- a/client/custom_environment.go +++ b/client/custom_environment.go @@ -35,7 +35,7 @@ func (c *Client) CreateCustomEnvironment(ctx context.Context, request CreateCust url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } payload := string(mustMarshal(request)) - tflog.Info(ctx, "creating custom environment", map[string]interface{}{ + tflog.Info(ctx, "creating custom environment", map[string]any{ "url": url, "payload": payload, }) @@ -64,7 +64,7 @@ func (c *Client) GetCustomEnvironment(ctx context.Context, request GetCustomEnvi if c.teamID(request.TeamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } - tflog.Info(ctx, "getting custom environment", map[string]interface{}{ + tflog.Info(ctx, "getting custom environment", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ @@ -96,7 +96,7 @@ func (c *Client) UpdateCustomEnvironment(ctx context.Context, request UpdateCust url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } payload := string(mustMarshal(request)) - tflog.Info(ctx, "updating custom environment", map[string]interface{}{ + tflog.Info(ctx, "updating custom environment", map[string]any{ "url": url, "payload": payload, }) @@ -125,7 +125,7 @@ func (c *Client) DeleteCustomEnvironment(ctx context.Context, request DeleteCust if c.teamID(request.TeamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } - tflog.Info(ctx, "deleting custom environment", map[string]interface{}{ + tflog.Info(ctx, "deleting custom environment", map[string]any{ "url": url, }) err := c.doRequest(clientRequest{ diff --git a/client/deploy_hooks.go b/client/deploy_hooks.go index cc50a56f..037292fa 100644 --- a/client/deploy_hooks.go +++ b/client/deploy_hooks.go @@ -28,7 +28,7 @@ func (c *Client) CreateDeployHook(ctx context.Context, request CreateDeployHookR url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } payload := string(mustMarshal(request)) - tflog.Info(ctx, "creating deploy hook", map[string]interface{}{ + tflog.Info(ctx, "creating deploy hook", map[string]any{ "url": url, "payload": payload, }) @@ -67,7 +67,7 @@ func (c *Client) DeleteDeployHook(ctx context.Context, request DeleteDeployHookR url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } payload := string(mustMarshal(request)) - tflog.Info(ctx, "creating deploy hook", map[string]interface{}{ + tflog.Info(ctx, "creating deploy hook", map[string]any{ "url": url, "payload": payload, }) diff --git a/client/deployment.go b/client/deployment.go index 7d82cc3f..61924940 100644 --- a/client/deployment.go +++ b/client/deployment.go @@ -32,20 +32,20 @@ type gitSource struct { // CreateDeploymentRequest defines the request the Vercel API expects in order to create a deployment. type CreateDeploymentRequest struct { - Files []DeploymentFile `json:"files,omitempty"` - Functions map[string]interface{} `json:"functions,omitempty"` - Environment map[string]string `json:"env,omitempty"` + Files []DeploymentFile `json:"files,omitempty"` + Functions map[string]any `json:"functions,omitempty"` + Environment map[string]string `json:"env,omitempty"` Build struct { Environment map[string]string `json:"env,omitempty"` } `json:"build,omitempty"` - ProjectID string `json:"project,omitempty"` - ProjectSettings map[string]interface{} `json:"projectSettings"` - Name string `json:"name"` - Regions []string `json:"regions,omitempty"` - Routes []interface{} `json:"routes,omitempty"` - Target string `json:"target,omitempty"` - GitSource *gitSource `json:"gitSource,omitempty"` - Ref string `json:"-"` + ProjectID string `json:"project,omitempty"` + ProjectSettings map[string]any `json:"projectSettings"` + Name string `json:"name"` + Regions []string `json:"regions,omitempty"` + Routes []any `json:"routes,omitempty"` + Target string `json:"target,omitempty"` + GitSource *gitSource `json:"gitSource,omitempty"` + Ref string `json:"-"` } // DeploymentResponse defines the response the Vercel API returns when a deployment is created or updated. @@ -201,7 +201,7 @@ func (c *Client) CreateDeployment(ctx context.Context, request CreateDeploymentR } payload := string(mustMarshal(request)) - tflog.Info(ctx, "creating deployment", map[string]interface{}{ + tflog.Info(ctx, "creating deployment", map[string]any{ "url": url, "payload": payload, }) @@ -263,7 +263,7 @@ func (c *Client) DeleteDeployment(ctx context.Context, deploymentID string, team url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "deleting deployment", map[string]interface{}{ + tflog.Info(ctx, "deleting deployment", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ @@ -282,7 +282,7 @@ func (c *Client) GetDeployment(ctx context.Context, deploymentID, teamID string) url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "getting deployment", map[string]interface{}{ + tflog.Info(ctx, "getting deployment", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ diff --git a/client/dns_record.go b/client/dns_record.go index 310b73fe..92374ffc 100644 --- a/client/dns_record.go +++ b/client/dns_record.go @@ -147,7 +147,7 @@ func (c *Client) UpdateDNSRecord(ctx context.Context, teamID, recordID string, r } payload := string(mustMarshal(request)) - tflog.Info(ctx, "updating DNS record", map[string]interface{}{ + tflog.Info(ctx, "updating DNS record", map[string]any{ "url": url, "payload": payload, }) diff --git a/client/edge_config.go b/client/edge_config.go index d81846c8..e0dc9812 100644 --- a/client/edge_config.go +++ b/client/edge_config.go @@ -24,7 +24,7 @@ func (c *Client) CreateEdgeConfig(ctx context.Context, request CreateEdgeConfigR url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } payload := string(mustMarshal(request)) - tflog.Info(ctx, "creating edge config", map[string]interface{}{ + tflog.Info(ctx, "creating edge config", map[string]any{ "url": url, "payload": payload, }) @@ -42,7 +42,7 @@ func (c *Client) GetEdgeConfig(ctx context.Context, id, teamID string) (e EdgeCo if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "reading edge config", map[string]interface{}{ + tflog.Info(ctx, "reading edge config", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ @@ -66,7 +66,7 @@ func (c *Client) UpdateEdgeConfig(ctx context.Context, request UpdateEdgeConfigR } payload := string(mustMarshal(request)) - tflog.Trace(ctx, "updating edge config", map[string]interface{}{ + tflog.Trace(ctx, "updating edge config", map[string]any{ "url": url, "payload": payload, }) @@ -84,7 +84,7 @@ func (c *Client) DeleteEdgeConfig(ctx context.Context, id, teamID string) error if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "deleting edge config", map[string]interface{}{ + tflog.Info(ctx, "deleting edge config", map[string]any{ "url": url, }) @@ -100,7 +100,7 @@ func (c *Client) ListEdgeConfigs(ctx context.Context, teamID string) (e []EdgeCo if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "listing edge configs", map[string]interface{}{ + tflog.Info(ctx, "listing edge configs", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ diff --git a/client/edge_config_item.go b/client/edge_config_item.go index f4c43058..e7f7a1ea 100644 --- a/client/edge_config_item.go +++ b/client/edge_config_item.go @@ -47,7 +47,7 @@ func (c *Client) CreateEdgeConfigItem(ctx context.Context, request CreateEdgeCon }, }, )) - tflog.Info(ctx, "creating edge config token", map[string]interface{}{ + tflog.Info(ctx, "creating edge config token", map[string]any{ "url": url, "payload": payload, }) @@ -93,7 +93,7 @@ func (c *Client) DeleteEdgeConfigItem(ctx context.Context, request EdgeConfigIte }, )) - tflog.Info(ctx, "deleting edge config token", map[string]interface{}{ + tflog.Info(ctx, "deleting edge config token", map[string]any{ "url": url, "payload": payload, }) @@ -111,7 +111,7 @@ func (c *Client) GetEdgeConfigItem(ctx context.Context, request EdgeConfigItemRe url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } - tflog.Info(ctx, "getting edge config token", map[string]interface{}{ + tflog.Info(ctx, "getting edge config token", map[string]any{ "url": url, }) diff --git a/client/edge_config_schema.go b/client/edge_config_schema.go index 582866b1..78efbe8c 100644 --- a/client/edge_config_schema.go +++ b/client/edge_config_schema.go @@ -19,7 +19,7 @@ func (c *Client) UpsertEdgeConfigSchema(ctx context.Context, request EdgeConfigS url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } payload := string(mustMarshal(request)) - tflog.Info(ctx, "creating edge config schema", map[string]interface{}{ + tflog.Info(ctx, "creating edge config schema", map[string]any{ "url": url, "payload": payload, }) @@ -39,7 +39,7 @@ func (c *Client) GetEdgeConfigSchema(ctx context.Context, id, teamID string) (e if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "getting edge config schema", map[string]interface{}{ + tflog.Info(ctx, "getting edge config schema", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ @@ -67,7 +67,7 @@ func (c *Client) DeleteEdgeConfigSchema(ctx context.Context, id, teamID string) if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "deleting edge config schema", map[string]interface{}{ + tflog.Info(ctx, "deleting edge config schema", map[string]any{ "url": url, }) return c.doRequest(clientRequest{ diff --git a/client/edge_config_token.go b/client/edge_config_token.go index 10f59179..3f7fc58b 100644 --- a/client/edge_config_token.go +++ b/client/edge_config_token.go @@ -35,7 +35,7 @@ func (c *Client) CreateEdgeConfigToken(ctx context.Context, request CreateEdgeCo url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } payload := string(mustMarshal(request)) - tflog.Info(ctx, "creating edge config token", map[string]interface{}{ + tflog.Info(ctx, "creating edge config token", map[string]any{ "url": url, "payload": payload, }) @@ -70,7 +70,7 @@ func (c *Client) DeleteEdgeConfigToken(ctx context.Context, request EdgeConfigTo }, )) - tflog.Info(ctx, "deleting edge config token", map[string]interface{}{ + tflog.Info(ctx, "deleting edge config token", map[string]any{ "url": url, "payload": payload, }) @@ -88,7 +88,7 @@ func (c *Client) GetEdgeConfigToken(ctx context.Context, request EdgeConfigToken url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } - tflog.Info(ctx, "getting edge config token", map[string]interface{}{ + tflog.Info(ctx, "getting edge config token", map[string]any{ "url": url, }) diff --git a/client/environment_variable.go b/client/environment_variable.go index 2d6b4031..d9adb770 100644 --- a/client/environment_variable.go +++ b/client/environment_variable.go @@ -33,7 +33,7 @@ func (c *Client) CreateEnvironmentVariable(ctx context.Context, request CreateEn } payload := string(mustMarshal(request.EnvironmentVariable)) - tflog.Info(ctx, "creating environment variable", map[string]interface{}{ + tflog.Info(ctx, "creating environment variable", map[string]any{ "url": url, "payload": payload, }) @@ -229,7 +229,7 @@ func (c *Client) UpdateEnvironmentVariable(ctx context.Context, request UpdateEn url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } payload := string(mustMarshal(request)) - tflog.Info(ctx, "updating environment variable", map[string]interface{}{ + tflog.Info(ctx, "updating environment variable", map[string]any{ "url": url, "payload": payload, }) @@ -251,7 +251,7 @@ func (c *Client) DeleteEnvironmentVariable(ctx context.Context, projectID, teamI if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "deleting environment variable", map[string]interface{}{ + tflog.Info(ctx, "deleting environment variable", map[string]any{ "url": url, }) return c.doRequest(clientRequest{ @@ -271,7 +271,7 @@ func (c *Client) GetEnvironmentVariables(ctx context.Context, projectID, teamID envResponse := struct { Env []EnvironmentVariable `json:"envs"` }{} - tflog.Info(ctx, "getting environment variables", map[string]interface{}{ + tflog.Info(ctx, "getting environment variables", map[string]any{ "url": url, }) err := c.doRequest(clientRequest{ @@ -293,7 +293,7 @@ func (c *Client) GetEnvironmentVariable(ctx context.Context, projectID, teamID, url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "getting environment variable", map[string]interface{}{ + tflog.Info(ctx, "getting environment variable", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ diff --git a/client/file.go b/client/file.go index da0c2555..0d20abd3 100644 --- a/client/file.go +++ b/client/file.go @@ -36,7 +36,7 @@ func (c *Client) CreateFile(ctx context.Context, request CreateFileRequest) erro req.Header.Add("x-vercel-digest", request.SHA) req.Header.Set("Content-Type", "application/octet-stream") - tflog.Info(ctx, "uploading file", map[string]interface{}{ + tflog.Info(ctx, "uploading file", map[string]any{ "url": url, "sha": request.SHA, }) diff --git a/client/integrations.go b/client/integrations.go index 2fc3053e..0f12281c 100644 --- a/client/integrations.go +++ b/client/integrations.go @@ -18,7 +18,7 @@ func (c *Client) GetIntegrationProjectAccess(ctx context.Context, integrationID, url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "getting integration project access", map[string]interface{}{ + tflog.Info(ctx, "getting integration project access", map[string]any{ "url": url, }) @@ -50,7 +50,7 @@ func (c *Client) GrantIntegrationProjectAccess(ctx context.Context, integrationI url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "getting integration project access", map[string]interface{}{ + tflog.Info(ctx, "getting integration project access", map[string]any{ "url": url, }) @@ -82,7 +82,7 @@ func (c *Client) RevokeIntegrationProjectAccess(ctx context.Context, integration url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "getting integration project access", map[string]interface{}{ + tflog.Info(ctx, "getting integration project access", map[string]any{ "url": url, }) diff --git a/client/log_drain.go b/client/log_drain.go index fe5be299..061e861b 100644 --- a/client/log_drain.go +++ b/client/log_drain.go @@ -38,7 +38,7 @@ func (c *Client) CreateLogDrain(ctx context.Context, request CreateLogDrainReque url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } payload := string(mustMarshal(request)) - tflog.Info(ctx, "creating log drain", map[string]interface{}{ + tflog.Info(ctx, "creating log drain", map[string]any{ "url": url, "payload": payload, }) @@ -56,7 +56,7 @@ func (c *Client) DeleteLogDrain(ctx context.Context, id, teamID string) error { if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "deleting log drain", map[string]interface{}{ + tflog.Info(ctx, "deleting log drain", map[string]any{ "url": url, }) return c.doRequest(clientRequest{ @@ -71,7 +71,7 @@ func (c *Client) GetLogDrain(ctx context.Context, id, teamID string) (l LogDrain if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "reading log drain", map[string]interface{}{ + tflog.Info(ctx, "reading log drain", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ diff --git a/client/microfrontend_group.go b/client/microfrontend_group.go index 737c3a64..de93cf86 100644 --- a/client/microfrontend_group.go +++ b/client/microfrontend_group.go @@ -39,7 +39,7 @@ func (c *Client) CreateMicrofrontendGroup(ctx context.Context, TeamID string, Na if c.teamID(TeamID) == "" { return r, fmt.Errorf("team_id is required") } - tflog.Info(ctx, "creating microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "creating microfrontend group", map[string]any{ "microfrontend_group_name": Name, "team_id": c.teamID(TeamID), }) @@ -79,7 +79,7 @@ func (c *Client) UpdateMicrofrontendGroup(ctx context.Context, request Microfron }{ Name: request.Name, })) - tflog.Info(ctx, "updating microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "updating microfrontend group", map[string]any{ "url": url, "payload": payload, }) @@ -109,7 +109,7 @@ func (c *Client) DeleteMicrofrontendGroup(ctx context.Context, request Microfron } url := fmt.Sprintf("%s/teams/%s/microfrontends/%s", c.baseURL, c.teamID(request.TeamID), request.ID) - tflog.Info(ctx, "deleting microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "deleting microfrontend group", map[string]any{ "url": url, }) @@ -131,7 +131,7 @@ func (c *Client) GetMicrofrontendGroup(ctx context.Context, microfrontendGroupID url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "getting microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "getting microfrontend group", map[string]any{ "url": url, }) out := MicrofrontendGroupsAPIResponse{} @@ -146,7 +146,7 @@ func (c *Client) GetMicrofrontendGroup(ctx context.Context, microfrontendGroupID return r, err } - tflog.Info(ctx, "getting microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "getting microfrontend group", map[string]any{ "out": out, }) @@ -176,7 +176,7 @@ func (c *Client) GetMicrofrontendGroup(ctx context.Context, microfrontendGroupID DefaultApp: defaultApp, Projects: projects, } - tflog.Info(ctx, "returning microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "returning microfrontend group", map[string]any{ "r": r, }) return r, nil diff --git a/client/microfrontend_group_membership.go b/client/microfrontend_group_membership.go index 91315a55..dafed06c 100644 --- a/client/microfrontend_group_membership.go +++ b/client/microfrontend_group_membership.go @@ -33,7 +33,7 @@ type MicrofrontendGroupMembershipsResponseAPI struct { } func (c *Client) GetMicrofrontendGroupMembership(ctx context.Context, TeamID string, GroupID string, ProjectID string) (r MicrofrontendGroupMembership, err error) { - tflog.Info(ctx, "getting microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "getting microfrontend group", map[string]any{ "project_id": ProjectID, "group_id": GroupID, "team_id": c.teamID(TeamID), @@ -42,7 +42,7 @@ func (c *Client) GetMicrofrontendGroupMembership(ctx context.Context, TeamID str if err != nil { return r, err } - tflog.Info(ctx, "getting microfrontend group membership", map[string]interface{}{ + tflog.Info(ctx, "getting microfrontend group membership", map[string]any{ "project_id": ProjectID, "group": group, }) @@ -50,7 +50,7 @@ func (c *Client) GetMicrofrontendGroupMembership(ctx context.Context, TeamID str } func (c *Client) AddOrUpdateMicrofrontendGroupMembership(ctx context.Context, request MicrofrontendGroupMembership) (r MicrofrontendGroupMembership, err error) { - tflog.Info(ctx, "adding / updating microfrontend project to group", map[string]interface{}{ + tflog.Info(ctx, "adding / updating microfrontend project to group", map[string]any{ "is_default_app": request.IsDefaultApp, "project_id": request.ProjectID, "group_id": request.MicrofrontendGroupID, @@ -71,7 +71,7 @@ func (c *Client) AddOrUpdateMicrofrontendGroupMembership(ctx context.Context, re } func (c *Client) RemoveMicrofrontendGroupMembership(ctx context.Context, request MicrofrontendGroupMembership) (r MicrofrontendGroupMembership, err error) { - tflog.Info(ctx, "removing microfrontend project from group", map[string]interface{}{ + tflog.Info(ctx, "removing microfrontend project from group", map[string]any{ "project_id": request.ProjectID, "group_id": request.MicrofrontendGroupID, "team_id": c.teamID(request.TeamID), @@ -111,7 +111,7 @@ func (c *Client) PatchMicrofrontendGroupMembership(ctx context.Context, request url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } - tflog.Info(ctx, "updating microfrontend group membership", map[string]interface{}{ + tflog.Info(ctx, "updating microfrontend group membership", map[string]any{ "url": url, "payload": payload, }) diff --git a/client/must_marshal.go b/client/must_marshal.go index 53d2f2e9..52d75d95 100644 --- a/client/must_marshal.go +++ b/client/must_marshal.go @@ -21,7 +21,7 @@ func (v *VercelAuthentication) MarshalJSON() ([]byte, error) { // are around the shape of the data. e.g. if a struct contains a channel, then it cannot // be marshaled. As our structs are known ahead of time and are all safe to marshal, // this simplifies the error checking process. -func mustMarshal(v interface{}) []byte { +func mustMarshal(v any) []byte { res, err := json.Marshal(v) if err != nil { //lintignore:R009 // this is okay as we know the shape of the data diff --git a/client/project.go b/client/project.go index 3b897410..3bba7fe8 100644 --- a/client/project.go +++ b/client/project.go @@ -69,7 +69,7 @@ func (c *Client) CreateProject(ctx context.Context, teamID string, request Creat } payload := string(mustMarshal(request)) - tflog.Info(ctx, "creating project", map[string]interface{}{ + tflog.Info(ctx, "creating project", map[string]any{ "url": url, "payload": payload, }) @@ -93,7 +93,7 @@ func (c *Client) DeleteProject(ctx context.Context, projectID, teamID string) er if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "deleting project", map[string]interface{}{ + tflog.Info(ctx, "deleting project", map[string]any{ "url": url, }) return c.doRequest(clientRequest{ @@ -227,7 +227,7 @@ func (c *Client) GetProject(ctx context.Context, projectID, teamID string) (r Pr if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "getting project", map[string]interface{}{ + tflog.Info(ctx, "getting project", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ @@ -254,7 +254,7 @@ func (c *Client) ListProjects(ctx context.Context, teamID string) (r []ProjectRe pr := struct { Projects []ProjectResponse `json:"projects"` }{} - tflog.Info(ctx, "listing projects", map[string]interface{}{ + tflog.Info(ctx, "listing projects", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ @@ -313,7 +313,7 @@ func (c *Client) UpdateProject(ctx context.Context, projectID, teamID string, re url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } payload := string(mustMarshal(request)) - tflog.Info(ctx, "updating project", map[string]interface{}{ + tflog.Info(ctx, "updating project", map[string]any{ "url": url, "payload": payload, }) @@ -343,7 +343,7 @@ func (c *Client) UpdateProductionBranch(ctx context.Context, request UpdateProdu url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } payload := string(mustMarshal(request)) - tflog.Info(ctx, "updating project production branch", map[string]interface{}{ + tflog.Info(ctx, "updating project production branch", map[string]any{ "url": url, "payload": payload, }) @@ -365,7 +365,7 @@ func (c *Client) UnlinkGitRepoFromProject(ctx context.Context, projectID, teamID if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "unlinking project git repo", map[string]interface{}{ + tflog.Info(ctx, "unlinking project git repo", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ @@ -392,7 +392,7 @@ func (c *Client) LinkGitRepoToProject(ctx context.Context, request LinkGitRepoTo if c.teamID(request.TeamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } - tflog.Info(ctx, "linking project git repo", map[string]interface{}{ + tflog.Info(ctx, "linking project git repo", map[string]any{ "url": url, }) payload := string(mustMarshal(request)) diff --git a/client/project_deployment_retention.go b/client/project_deployment_retention.go index 8c05a7fb..6944d6d8 100644 --- a/client/project_deployment_retention.go +++ b/client/project_deployment_retention.go @@ -33,7 +33,7 @@ func (c *Client) DeleteDeploymentRetention(ctx context.Context, projectID, teamI unlimited := "unlimited" payload := string(mustMarshal(DeploymentRetentionRequest{ExpirationPreview: unlimited, ExpirationProduction: unlimited, ExpirationCanceled: unlimited, ExpirationErrored: unlimited})) - tflog.Info(ctx, "updating deployment expiration", map[string]interface{}{ + tflog.Info(ctx, "updating deployment expiration", map[string]any{ "url": url, "payload": payload, }) @@ -94,7 +94,7 @@ func (c *Client) UpdateDeploymentRetention(ctx context.Context, request UpdateDe } payload := string(mustMarshal(request.DeploymentRetention)) - tflog.Info(ctx, "updating deployment expiration", map[string]interface{}{ + tflog.Info(ctx, "updating deployment expiration", map[string]any{ "url": url, "payload": payload, }) @@ -115,7 +115,7 @@ func (c *Client) GetDeploymentRetention(ctx context.Context, projectID, teamID s url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "getting deployment retention", map[string]interface{}{ + tflog.Info(ctx, "getting deployment retention", map[string]any{ "url": url, }) var p ProjectResponse diff --git a/client/project_domain.go b/client/project_domain.go index d0f22fc2..12199325 100644 --- a/client/project_domain.go +++ b/client/project_domain.go @@ -27,7 +27,7 @@ func (c *Client) CreateProjectDomain(ctx context.Context, projectID, teamID stri } payload := string(mustMarshal(request)) - tflog.Info(ctx, "creating project domain", map[string]interface{}{ + tflog.Info(ctx, "creating project domain", map[string]any{ "url": url, "payload": payload, }) @@ -48,7 +48,7 @@ func (c *Client) DeleteProjectDomain(ctx context.Context, projectID, domain, tea url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "deleting project domain", map[string]interface{}{ + tflog.Info(ctx, "deleting project domain", map[string]any{ "url": url, }) return c.doRequest(clientRequest{ @@ -78,7 +78,7 @@ func (c *Client) GetProjectDomain(ctx context.Context, projectID, domain, teamID url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "getting project domain", map[string]interface{}{ + tflog.Info(ctx, "getting project domain", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ @@ -107,7 +107,7 @@ func (c *Client) UpdateProjectDomain(ctx context.Context, projectID, domain, tea } payload := string(mustMarshal(request)) - tflog.Info(ctx, "updating project domain", map[string]interface{}{ + tflog.Info(ctx, "updating project domain", map[string]any{ "url": url, "payload": payload, }) diff --git a/client/project_function_cpu.go b/client/project_function_cpu.go index 7d46c243..6e171734 100644 --- a/client/project_function_cpu.go +++ b/client/project_function_cpu.go @@ -40,7 +40,7 @@ func (c *Client) GetProjectFunctionCPU(ctx context.Context, projectID, teamID st if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "get project function cpu", map[string]interface{}{ + tflog.Info(ctx, "get project function cpu", map[string]any{ "url": url, }) var f functionCPU diff --git a/client/project_member.go b/client/project_member.go index 6289ed0c..f4324fa6 100644 --- a/client/project_member.go +++ b/client/project_member.go @@ -25,7 +25,7 @@ func (c *Client) AddProjectMembers(ctx context.Context, request AddProjectMember if c.teamID(request.TeamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } - tflog.Info(ctx, "adding project members", map[string]interface{}{ + tflog.Info(ctx, "adding project members", map[string]any{ "url": url, }) err := c.doRequest(clientRequest{ @@ -35,7 +35,7 @@ func (c *Client) AddProjectMembers(ctx context.Context, request AddProjectMember body: string(mustMarshal(request)), }, nil) if err != nil { - tflog.Error(ctx, "error adding project members", map[string]interface{}{ + tflog.Error(ctx, "error adding project members", map[string]any{ "url": url, "members": request.Members, }) @@ -54,7 +54,7 @@ func (c *Client) RemoveProjectMembers(ctx context.Context, request RemoveProject if c.teamID(request.TeamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } - tflog.Info(ctx, "removing project members", map[string]interface{}{ + tflog.Info(ctx, "removing project members", map[string]any{ "url": url, }) err := c.doRequest(clientRequest{ @@ -64,7 +64,7 @@ func (c *Client) RemoveProjectMembers(ctx context.Context, request RemoveProject body: string(mustMarshal(request)), }, nil) if err != nil { - tflog.Error(ctx, "error removing project members", map[string]interface{}{ + tflog.Error(ctx, "error removing project members", map[string]any{ "url": url, "members": request.Members, }) @@ -89,7 +89,7 @@ func (c *Client) UpdateProjectMembers(ctx context.Context, request UpdateProject url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } payload := string(mustMarshal(request)) - tflog.Info(ctx, "updating project members", map[string]interface{}{ + tflog.Info(ctx, "updating project members", map[string]any{ "url": url, "payload": payload, }) @@ -100,7 +100,7 @@ func (c *Client) UpdateProjectMembers(ctx context.Context, request UpdateProject body: payload, }, nil) if err != nil { - tflog.Error(ctx, "error updating project members", map[string]interface{}{ + tflog.Error(ctx, "error updating project members", map[string]any{ "url": url, "members": request.Members, }) @@ -118,7 +118,7 @@ func (c *Client) ListProjectMembers(ctx context.Context, request GetProjectMembe if c.teamID(request.TeamID) != "" { url = fmt.Sprintf("%s?teamId=%s&limit=100", url, c.teamID(request.TeamID)) } - tflog.Info(ctx, "listing project members", map[string]interface{}{ + tflog.Info(ctx, "listing project members", map[string]any{ "url": url, }) @@ -132,7 +132,7 @@ func (c *Client) ListProjectMembers(ctx context.Context, request GetProjectMembe body: string(mustMarshal(request)), }, &resp) if err != nil { - tflog.Error(ctx, "error getting project members", map[string]interface{}{ + tflog.Error(ctx, "error getting project members", map[string]any{ "url": url, }) } diff --git a/client/project_protection_bypass_for_automation_update.go b/client/project_protection_bypass_for_automation_update.go index 667c8b56..11647c11 100644 --- a/client/project_protection_bypass_for_automation_update.go +++ b/client/project_protection_bypass_for_automation_update.go @@ -54,7 +54,7 @@ func (c *Client) UpdateProtectionBypassForAutomation(ctx context.Context, reques } payload := getUpdateBypassProtectionRequestBody(request.NewValue, request.Secret) - tflog.Info(ctx, "updating protection bypass", map[string]interface{}{ + tflog.Info(ctx, "updating protection bypass", map[string]any{ "url": url, "payload": payload, "newValue": request.NewValue, diff --git a/client/request.go b/client/request.go index a366b6c9..75a58720 100644 --- a/client/request.go +++ b/client/request.go @@ -68,7 +68,7 @@ func (cr *clientRequest) toHTTPRequest() (*http.Request, error) { // - Unmarshaling responses // - Parsing a Retry-After header in the case of rate limits being hit // - In the case of a rate-limit being hit, trying again aftera period of time -func (c *Client) doRequest(req clientRequest, v interface{}) error { +func (c *Client) doRequest(req clientRequest, v any) error { r, err := req.toHTTPRequest() if err != nil { return err @@ -80,7 +80,7 @@ func (c *Client) doRequest(req clientRequest, v interface{}) error { apiErr.StatusCode == 429 && // and it was a rate limit apiErr.retryAfter > 0 && // and there was a retry time apiErr.retryAfter < 5*60 { // and the retry time is less than 5 minutes - tflog.Error(req.ctx, "Rate limit was hit", map[string]interface{}{ + tflog.Error(req.ctx, "Rate limit was hit", map[string]any{ "error": apiErr, "retryAfter": apiErr.retryAfter, }) @@ -102,7 +102,7 @@ func (c *Client) doRequest(req clientRequest, v interface{}) error { return err } -func (c *Client) _doRequest(req *http.Request, v interface{}, errorOnNoContent bool) error { +func (c *Client) _doRequest(req *http.Request, v any, errorOnNoContent bool) error { req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.token)) resp, err := c.http().Do(req) if err != nil { diff --git a/client/shared_environment_variable.go b/client/shared_environment_variable.go index f8cc5115..2e6c5d13 100644 --- a/client/shared_environment_variable.go +++ b/client/shared_environment_variable.go @@ -65,7 +65,7 @@ func (c *Client) CreateSharedEnvironmentVariable(ctx context.Context, request Cr url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } payload := string(mustMarshal(request.EnvironmentVariable)) - tflog.Info(ctx, "creating shared environment variable", map[string]interface{}{ + tflog.Info(ctx, "creating shared environment variable", map[string]any{ "url": url, "payload": payload, }) @@ -109,7 +109,7 @@ func (c *Client) DeleteSharedEnvironmentVariable(ctx context.Context, teamID, va variableID, }, })) - tflog.Info(ctx, "deleting shared environment variable", map[string]interface{}{ + tflog.Info(ctx, "deleting shared environment variable", map[string]any{ "url": url, }) return c.doRequest(clientRequest{ @@ -126,7 +126,7 @@ func (c *Client) GetSharedEnvironmentVariable(ctx context.Context, teamID, envID url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "getting shared environment variable", map[string]interface{}{ + tflog.Info(ctx, "getting shared environment variable", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ @@ -145,7 +145,7 @@ func (c *Client) ListSharedEnvironmentVariables(ctx context.Context, teamID stri url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "listing shared environment variables", map[string]interface{}{ + tflog.Info(ctx, "listing shared environment variables", map[string]any{ "url": url, }) res := struct { @@ -192,7 +192,7 @@ func (c *Client) UpdateSharedEnvironmentVariable(ctx context.Context, request Up }, })) - tflog.Info(ctx, "updating shared environment variable", map[string]interface{}{ + tflog.Info(ctx, "updating shared environment variable", map[string]any{ "url": url, "payload": payload, }) diff --git a/client/team.go b/client/team.go index a9832845..624cc983 100644 --- a/client/team.go +++ b/client/team.go @@ -107,7 +107,7 @@ type Team struct { // GetTeam returns information about an existing team within vercel. func (c *Client) GetTeam(ctx context.Context, idOrSlug string) (t Team, err error) { url := fmt.Sprintf("%s/v2/teams/%s", c.baseURL, idOrSlug) - tflog.Info(ctx, "getting team", map[string]interface{}{ + tflog.Info(ctx, "getting team", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ @@ -144,7 +144,7 @@ type UpdateTeamRequest struct { func (c *Client) UpdateTeam(ctx context.Context, request UpdateTeamRequest) (t Team, err error) { url := fmt.Sprintf("%s/v2/teams/%s", c.baseURL, request.TeamID) payload := string(mustMarshal(request)) - tflog.Info(ctx, "updating team", map[string]interface{}{ + tflog.Info(ctx, "updating team", map[string]any{ "url": url, "payload": payload, }) diff --git a/client/team_member.go b/client/team_member.go index d77b4260..c25f490f 100644 --- a/client/team_member.go +++ b/client/team_member.go @@ -23,7 +23,7 @@ type TeamMemberInviteRequest struct { func (c *Client) InviteTeamMember(ctx context.Context, request TeamMemberInviteRequest) error { url := fmt.Sprintf("%s/v1/teams/%s/members", c.baseURL, request.TeamID) - tflog.Info(ctx, "inviting user", map[string]interface{}{ + tflog.Info(ctx, "inviting user", map[string]any{ "url": url, "user": request.UserID, "email": request.Email, @@ -46,7 +46,7 @@ type TeamMemberRemoveRequest struct { func (c *Client) RemoveTeamMember(ctx context.Context, request TeamMemberRemoveRequest) error { url := fmt.Sprintf("%s/v2/teams/%s/members/%s", c.baseURL, request.TeamID, request.UserID) - tflog.Info(ctx, "removing user", map[string]interface{}{ + tflog.Info(ctx, "removing user", map[string]any{ "url": url, "user": request.UserID, }) @@ -70,7 +70,7 @@ type TeamMemberUpdateRequest struct { func (c *Client) UpdateTeamMember(ctx context.Context, request TeamMemberUpdateRequest) error { url := fmt.Sprintf("%s/v1/teams/%s/members/%s", c.baseURL, request.TeamID, request.UserID) - tflog.Info(ctx, "updating team member", map[string]interface{}{ + tflog.Info(ctx, "updating team member", map[string]any{ "url": url, "user": request.UserID, "role": request.Role, @@ -102,7 +102,7 @@ type TeamMember struct { func (c *Client) GetTeamMember(ctx context.Context, request GetTeamMemberRequest) (TeamMember, error) { url := fmt.Sprintf("%s/v2/teams/%s/members?limit=1&filterByUserIds=%s", c.baseURL, request.TeamID, request.UserID) - tflog.Info(ctx, "getting team member", map[string]interface{}{ + tflog.Info(ctx, "getting team member", map[string]any{ "url": url, }) diff --git a/client/webhook.go b/client/webhook.go index 9dab60ec..15153607 100644 --- a/client/webhook.go +++ b/client/webhook.go @@ -29,7 +29,7 @@ func (c *Client) CreateWebhook(ctx context.Context, request CreateWebhookRequest url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(request.TeamID)) } payload := string(mustMarshal(request)) - tflog.Info(ctx, "creating webhook", map[string]interface{}{ + tflog.Info(ctx, "creating webhook", map[string]any{ "url": url, "payload": payload, }) @@ -47,7 +47,7 @@ func (c *Client) DeleteWebhook(ctx context.Context, id, teamID string) error { if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "deleting webhook", map[string]interface{}{ + tflog.Info(ctx, "deleting webhook", map[string]any{ "url": url, }) return c.doRequest(clientRequest{ @@ -62,7 +62,7 @@ func (c *Client) GetWebhook(ctx context.Context, id, teamID string) (w Webhook, if c.teamID(teamID) != "" { url = fmt.Sprintf("%s?teamId=%s", url, c.teamID(teamID)) } - tflog.Info(ctx, "getting webhook", map[string]interface{}{ + tflog.Info(ctx, "getting webhook", map[string]any{ "url": url, }) err = c.doRequest(clientRequest{ diff --git a/docs/resources/team_member.md b/docs/resources/team_member.md index 4ac60bf1..90d11908 100644 --- a/docs/resources/team_member.md +++ b/docs/resources/team_member.md @@ -48,5 +48,5 @@ Import is supported using the following syntax: ```shell # To import, use the team_id and user_id. -terraform import vercel_access_group.example team_xxxxxxxxxxxxxxxxxxxxxxxx/uuuuuuuuuuuuuuuuuuuuuuuuuu +terraform import vercel_team_member.example team_xxxxxxxxxxxxxxxxxxxxxxxx/uuuuuuuuuuuuuuuuuuuuuuuuuu ``` diff --git a/examples/resources/vercel_team_member/import.sh b/examples/resources/vercel_team_member/import.sh index 1efe8a13..7bd9608b 100644 --- a/examples/resources/vercel_team_member/import.sh +++ b/examples/resources/vercel_team_member/import.sh @@ -1,2 +1,2 @@ # To import, use the team_id and user_id. -terraform import vercel_access_group.example team_xxxxxxxxxxxxxxxxxxxxxxxx/uuuuuuuuuuuuuuuuuuuuuuuuuu +terraform import vercel_team_member.example team_xxxxxxxxxxxxxxxxxxxxxxxx/uuuuuuuuuuuuuuuuuuuuuuuuuu diff --git a/vercel/data_source_access_group.go b/vercel/data_source_access_group.go index 713bfcc4..d1a19af2 100644 --- a/vercel/data_source_access_group.go +++ b/vercel/data_source_access_group.go @@ -102,7 +102,7 @@ func (d *accessGroupDataSource) Read(ctx context.Context, req datasource.ReadReq TeamID: types.StringValue(out.TeamID), Name: types.StringValue(out.Name), } - tflog.Info(ctx, "read Access Group", map[string]interface{}{ + tflog.Info(ctx, "read Access Group", map[string]any{ "team_id": result.TeamID.ValueString(), "access_group_id": result.ID.ValueString(), "name": result.Name.ValueString(), diff --git a/vercel/data_source_access_group_project.go b/vercel/data_source_access_group_project.go index fbdb76d7..410c2421 100644 --- a/vercel/data_source_access_group_project.go +++ b/vercel/data_source_access_group_project.go @@ -109,7 +109,7 @@ func (d *accessGroupProjectDataSource) Read(ctx context.Context, req datasource. ProjectID: types.StringValue(out.ProjectID), Role: types.StringValue(out.Role), } - tflog.Info(ctx, "read Access Group Project", map[string]interface{}{ + tflog.Info(ctx, "read Access Group Project", map[string]any{ "team_id": result.TeamID.ValueString(), "access_group_id": result.AccessGroupID.ValueString(), "project_id": result.ProjectID.ValueString(), diff --git a/vercel/data_source_alias.go b/vercel/data_source_alias.go index 560bd8bd..2de04095 100644 --- a/vercel/data_source_alias.go +++ b/vercel/data_source_alias.go @@ -98,7 +98,7 @@ func (d *aliasDataSource) Read(ctx context.Context, req datasource.ReadRequest, } result := convertResponseToAlias(out, config) - tflog.Info(ctx, "read alias", map[string]interface{}{ + tflog.Info(ctx, "read alias", map[string]any{ "team_id": result.TeamID.ValueString(), "alias": result.Alias.ValueString(), }) diff --git a/vercel/data_source_attack_challenge_mode.go b/vercel/data_source_attack_challenge_mode.go index 32d5970d..83db1661 100644 --- a/vercel/data_source_attack_challenge_mode.go +++ b/vercel/data_source_attack_challenge_mode.go @@ -100,7 +100,7 @@ func (d *attackChallengeModeDataSource) Read(ctx context.Context, req datasource } result := responseToAttackChallengeMode(out) - tflog.Info(ctx, "read attack challenge mode", map[string]interface{}{ + tflog.Info(ctx, "read attack challenge mode", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) diff --git a/vercel/data_source_custom_environment.go b/vercel/data_source_custom_environment.go index 038a933e..25a6eed1 100644 --- a/vercel/data_source_custom_environment.go +++ b/vercel/data_source_custom_environment.go @@ -120,7 +120,7 @@ func (d *customEnvironmentDataSource) Read(ctx context.Context, req datasource.R ) return } - tflog.Trace(ctx, "read custom environment", map[string]interface{}{ + tflog.Trace(ctx, "read custom environment", map[string]any{ "team_id": config.TeamID.ValueString(), "project_id": config.ProjectID.ValueString(), "custom_environment_id": res.ID, diff --git a/vercel/data_source_deployment.go b/vercel/data_source_deployment.go index 264e622c..5834815e 100644 --- a/vercel/data_source_deployment.go +++ b/vercel/data_source_deployment.go @@ -151,7 +151,7 @@ func (d *deploymentDataSource) Read(ctx context.Context, req datasource.ReadRequ } result := convertResponseToDeploymentDataSource(out) - tflog.Info(ctx, "read deployment", map[string]interface{}{ + tflog.Info(ctx, "read deployment", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ID.ValueString(), }) diff --git a/vercel/data_source_edge_config.go b/vercel/data_source_edge_config.go index 46f3b813..4f2c8961 100644 --- a/vercel/data_source_edge_config.go +++ b/vercel/data_source_edge_config.go @@ -96,7 +96,7 @@ func (d *edgeConfigDataSource) Read(ctx context.Context, req datasource.ReadRequ } result := responseToEdgeConfig(out) - tflog.Info(ctx, "read edge config", map[string]interface{}{ + tflog.Info(ctx, "read edge config", map[string]any{ "team_id": result.TeamID.ValueString(), "edge_config_id": result.ID.ValueString(), }) diff --git a/vercel/data_source_edge_config_item.go b/vercel/data_source_edge_config_item.go index 4c48dcd9..d0313bf4 100644 --- a/vercel/data_source_edge_config_item.go +++ b/vercel/data_source_edge_config_item.go @@ -114,7 +114,7 @@ func (d *edgeConfigItemDataSource) Read(ctx context.Context, req datasource.Read } result := responseToEdgeConfigItem(out) - tflog.Info(ctx, "read edge config item", map[string]interface{}{ + tflog.Info(ctx, "read edge config item", map[string]any{ "edge_config_id": result.EdgeConfigID.ValueString(), "team_id": result.TeamID.ValueString(), "key": result.Key.ValueString(), diff --git a/vercel/data_source_edge_config_schema.go b/vercel/data_source_edge_config_schema.go index 2b8967f3..f736f848 100644 --- a/vercel/data_source_edge_config_schema.go +++ b/vercel/data_source_edge_config_schema.go @@ -106,7 +106,7 @@ func (d *edgeConfigSchemaDataSource) Read(ctx context.Context, req datasource.Re return } result := responseToEdgeConfigSchema(out, types.StringValue(string(def))) - tflog.Info(ctx, "read edge config schema", map[string]interface{}{ + tflog.Info(ctx, "read edge config schema", map[string]any{ "team_id": result.TeamID.ValueString(), "edge_config_id": result.ID.ValueString(), }) diff --git a/vercel/data_source_edge_config_token.go b/vercel/data_source_edge_config_token.go index 994903f4..d7765888 100644 --- a/vercel/data_source_edge_config_token.go +++ b/vercel/data_source_edge_config_token.go @@ -114,7 +114,7 @@ func (d *edgeConfigTokenDataSource) Read(ctx context.Context, req datasource.Rea } result := responseToEdgeConfigToken(out) - tflog.Info(ctx, "read edge config token", map[string]interface{}{ + tflog.Info(ctx, "read edge config token", map[string]any{ "team_id": result.TeamID.ValueString(), "edge_config_id": result.ID.ValueString(), }) diff --git a/vercel/data_source_log_drain.go b/vercel/data_source_log_drain.go index 8eb0f87d..1af4b169 100644 --- a/vercel/data_source_log_drain.go +++ b/vercel/data_source_log_drain.go @@ -183,7 +183,7 @@ func (d *logDrainDataSource) Read(ctx context.Context, req datasource.ReadReques if resp.Diagnostics.HasError() { return } - tflog.Info(ctx, "read log drain", map[string]interface{}{ + tflog.Info(ctx, "read log drain", map[string]any{ "team_id": result.TeamID.ValueString(), "log_drain_id": result.ID.ValueString(), }) diff --git a/vercel/data_source_microfrontend_group.go b/vercel/data_source_microfrontend_group.go index 788fe96a..15a07400 100644 --- a/vercel/data_source_microfrontend_group.go +++ b/vercel/data_source_microfrontend_group.go @@ -52,7 +52,7 @@ func (r *microfrontendGroupDataSource) Schema(_ context.Context, req datasource. Description: ` Provides information about an existing Microfrontend Group. -A Microfrontend Group is a definition of a microfrontend belonging to a Vercel Team. +A Microfrontend Group is a definition of a microfrontend belonging to a Vercel Team. `, Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -117,7 +117,7 @@ func (d *microfrontendGroupDataSource) Read(ctx context.Context, req datasource. } result := convertResponseToMicrofrontendGroup(out) - tflog.Info(ctx, "read microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "read microfrontend group", map[string]any{ "result": result, }) diff --git a/vercel/data_source_microfrontend_group_membership.go b/vercel/data_source_microfrontend_group_membership.go index 2eca3831..6b2ea4b6 100644 --- a/vercel/data_source_microfrontend_group_membership.go +++ b/vercel/data_source_microfrontend_group_membership.go @@ -52,7 +52,7 @@ func (r *microfrontendGroupMembershipDataSource) Schema(_ context.Context, req d Description: ` Provides information about an existing Microfrontend Group Membership. -A Microfrontend Group Membership is a definition of a Vercel Project being a part of a Microfrontend Group. +A Microfrontend Group Membership is a definition of a Vercel Project being a part of a Microfrontend Group. `, Attributes: map[string]schema.Attribute{ "project_id": schema.StringAttribute{ @@ -109,7 +109,7 @@ func (d *microfrontendGroupMembershipDataSource) Read(ctx context.Context, req d } result := convertResponseToMicrofrontendGroupMembership(out) - tflog.Info(ctx, "read microfrontend group membership", map[string]interface{}{ + tflog.Info(ctx, "read microfrontend group membership", map[string]any{ "team_id": result.TeamID.ValueString(), "group_id": result.MicrofrontendGroupID.ValueString(), "project_id": result.ProjectID.ValueString(), diff --git a/vercel/data_source_project.go b/vercel/data_source_project.go index 2f5ebda9..405131d2 100644 --- a/vercel/data_source_project.go +++ b/vercel/data_source_project.go @@ -523,7 +523,7 @@ func (d *projectDataSource) Read(ctx context.Context, req datasource.ReadRequest ) return } - tflog.Info(ctx, "read project", map[string]interface{}{ + tflog.Info(ctx, "read project", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ID.ValueString(), }) diff --git a/vercel/data_source_project_deployment_retention.go b/vercel/data_source_project_deployment_retention.go index ba5802e7..7dc55803 100644 --- a/vercel/data_source_project_deployment_retention.go +++ b/vercel/data_source_project_deployment_retention.go @@ -123,7 +123,7 @@ func (r *projectDeploymentRetentionDataSource) Read(ctx context.Context, req dat } result := convertResponseToProjectDeploymentRetention(out, config.ProjectID, config.TeamID) - tflog.Info(ctx, "read project deployment retention", map[string]interface{}{ + tflog.Info(ctx, "read project deployment retention", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) diff --git a/vercel/data_source_shared_environment_variable.go b/vercel/data_source_shared_environment_variable.go index e2924ce3..4b6ded9b 100644 --- a/vercel/data_source_shared_environment_variable.go +++ b/vercel/data_source_shared_environment_variable.go @@ -180,7 +180,7 @@ func (d *sharedEnvironmentVariableDataSource) Read(ctx context.Context, req data ) return } - tflog.Info(ctx, "list shared environment variable", map[string]interface{}{ + tflog.Info(ctx, "list shared environment variable", map[string]any{ "team_id": config.TeamID.ValueString(), }) var configTarget []types.String @@ -233,7 +233,7 @@ func (d *sharedEnvironmentVariableDataSource) Read(ctx context.Context, req data } result := convertResponseToSharedEnvironmentVariable(out, types.StringNull()) - tflog.Info(ctx, "read shared environment variable", map[string]interface{}{ + tflog.Info(ctx, "read shared environment variable", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ID.ValueString(), }) diff --git a/vercel/resource_access_group.go b/vercel/resource_access_group.go index c989b855..d96aa9c8 100644 --- a/vercel/resource_access_group.go +++ b/vercel/resource_access_group.go @@ -111,7 +111,7 @@ func (r *accessGroupResource) Create(ctx context.Context, req resource.CreateReq TeamID: types.StringValue(out.TeamID), } - tflog.Info(ctx, "created Access Group", map[string]interface{}{ + tflog.Info(ctx, "created Access Group", map[string]any{ "team_id": result.TeamID.ValueString(), "id": result.ID.ValueString(), }) @@ -159,7 +159,7 @@ func (r *accessGroupResource) Read(ctx context.Context, req resource.ReadRequest Name: types.StringValue(out.Name), } - tflog.Info(ctx, "read Access Group", map[string]interface{}{ + tflog.Info(ctx, "read Access Group", map[string]any{ "team_id": result.TeamID.ValueString(), "id": result.ID.ValueString(), "name": result.Name.ValueString(), @@ -209,7 +209,7 @@ func (r *accessGroupResource) Update(ctx context.Context, req resource.UpdateReq Name: types.StringValue(out.Name), } - tflog.Trace(ctx, "update Access Group", map[string]interface{}{ + tflog.Trace(ctx, "update Access Group", map[string]any{ "team_id": result.TeamID.ValueString(), "id": result.ID.ValueString(), }) @@ -251,7 +251,7 @@ func (r *accessGroupResource) Delete(ctx context.Context, req resource.DeleteReq return } - tflog.Info(ctx, "deleted Access Group", map[string]interface{}{ + tflog.Info(ctx, "deleted Access Group", map[string]any{ "team_id": state.TeamID.ValueString(), "id": state.ID.ValueString(), }) @@ -294,7 +294,7 @@ func (r *accessGroupResource) ImportState(ctx context.Context, req resource.Impo Name: types.StringValue(out.Name), } - tflog.Info(ctx, "import Access Group", map[string]interface{}{ + tflog.Info(ctx, "import Access Group", map[string]any{ "team_id": result.TeamID.ValueString(), "id": result.ID.ValueString(), "name": result.Name.ValueString(), diff --git a/vercel/resource_access_group_project.go b/vercel/resource_access_group_project.go index ac35e386..5dfe4810 100644 --- a/vercel/resource_access_group_project.go +++ b/vercel/resource_access_group_project.go @@ -131,7 +131,7 @@ func (r *accessGroupProjectResource) Create(ctx context.Context, req resource.Cr Role: types.StringValue(out.Role), } - tflog.Info(ctx, "created Access Group", map[string]interface{}{ + tflog.Info(ctx, "created Access Group", map[string]any{ "team_id": result.TeamID.ValueString(), "access_group_id": result.AccessGroupID.ValueString(), "project_id": result.ProjectID.ValueString(), @@ -181,7 +181,7 @@ func (r *accessGroupProjectResource) Read(ctx context.Context, req resource.Read ProjectID: types.StringValue(out.ProjectID), Role: types.StringValue(out.Role), } - tflog.Info(ctx, "read Access Group Project", map[string]interface{}{ + tflog.Info(ctx, "read Access Group Project", map[string]any{ "team_id": state.TeamID.ValueString(), "access_group_id": state.AccessGroupID.ValueString(), "project_id": state.ProjectID.ValueString(), @@ -230,7 +230,7 @@ func (r *accessGroupProjectResource) Update(ctx context.Context, req resource.Up Role: types.StringValue(out.Role), } - tflog.Info(ctx, "updated Access Group Project", map[string]interface{}{ + tflog.Info(ctx, "updated Access Group Project", map[string]any{ "team_id": result.TeamID.ValueString(), "access_group_id": result.AccessGroupID.ValueString(), "project_id": result.ProjectID.ValueString(), @@ -276,7 +276,7 @@ func (r *accessGroupProjectResource) Delete(ctx context.Context, req resource.De return } - tflog.Info(ctx, "deleted Access Group", map[string]interface{}{ + tflog.Info(ctx, "deleted Access Group", map[string]any{ "team_id": state.TeamID.ValueString(), "access_group_id": state.AccessGroupID.ValueString(), "project_id": state.ProjectID.ValueString(), @@ -324,7 +324,7 @@ func (r *accessGroupProjectResource) ImportState(ctx context.Context, req resour Role: types.StringValue(out.Role), } - tflog.Info(ctx, "import Access Group Project", map[string]interface{}{ + tflog.Info(ctx, "import Access Group Project", map[string]any{ "team_id": result.TeamID.ValueString(), "access_group_id": result.AccessGroupID.ValueString(), "project_id": result.ProjectID.ValueString(), diff --git a/vercel/resource_alias.go b/vercel/resource_alias.go index 35ae34cf..fae24098 100644 --- a/vercel/resource_alias.go +++ b/vercel/resource_alias.go @@ -122,7 +122,7 @@ func (r *aliasResource) Create(ctx context.Context, req resource.CreateRequest, } result := convertResponseToAlias(out, plan) - tflog.Info(ctx, "created alias", map[string]interface{}{ + tflog.Info(ctx, "created alias", map[string]any{ "team_id": plan.TeamID.ValueString(), "deployment_id": plan.DeploymentID.ValueString(), "alias_id": result.ID.ValueString(), @@ -163,7 +163,7 @@ func (r *aliasResource) Read(ctx context.Context, req resource.ReadRequest, resp } result := convertResponseToAlias(out, state) - tflog.Info(ctx, "read alias", map[string]interface{}{ + tflog.Info(ctx, "read alias", map[string]any{ "team_id": result.TeamID.ValueString(), "alias_id": result.ID.ValueString(), }) @@ -208,7 +208,7 @@ func (r *aliasResource) Delete(ctx context.Context, req resource.DeleteRequest, return } - tflog.Info(ctx, "deleted alias", map[string]interface{}{ + tflog.Info(ctx, "deleted alias", map[string]any{ "team_id": state.TeamID.ValueString(), "alias_id": state.ID.ValueString(), }) diff --git a/vercel/resource_attack_challenge_mode.go b/vercel/resource_attack_challenge_mode.go index 44d93694..cda11729 100644 --- a/vercel/resource_attack_challenge_mode.go +++ b/vercel/resource_attack_challenge_mode.go @@ -127,7 +127,7 @@ func (r *attackChallengeModeResource) Create(ctx context.Context, req resource.C } result := responseToAttackChallengeMode(out) - tflog.Info(ctx, "created attack challenge mode", map[string]interface{}{ + tflog.Info(ctx, "created attack challenge mode", map[string]any{ "team_id": plan.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) @@ -165,7 +165,7 @@ func (r *attackChallengeModeResource) Read(ctx context.Context, req resource.Rea } result := responseToAttackChallengeMode(out) - tflog.Info(ctx, "read attack challenge mode", map[string]interface{}{ + tflog.Info(ctx, "read attack challenge mode", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) @@ -208,7 +208,7 @@ func (r *attackChallengeModeResource) Update(ctx context.Context, req resource.U } result := responseToAttackChallengeMode(out) - tflog.Trace(ctx, "update attack challenge mode", map[string]interface{}{ + tflog.Trace(ctx, "update attack challenge mode", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) @@ -250,7 +250,7 @@ func (r *attackChallengeModeResource) Delete(ctx context.Context, req resource.D return } - tflog.Info(ctx, "deleted attack challenge mode", map[string]interface{}{ + tflog.Info(ctx, "deleted attack challenge mode", map[string]any{ "team_id": state.TeamID.ValueString(), "project_id": state.ProjectID.ValueString(), }) @@ -283,7 +283,7 @@ func (r *attackChallengeModeResource) ImportState(ctx context.Context, req resou } result := responseToAttackChallengeMode(out) - tflog.Info(ctx, "import attack challenge mode", map[string]interface{}{ + tflog.Info(ctx, "import attack challenge mode", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) diff --git a/vercel/resource_custom_environment.go b/vercel/resource_custom_environment.go index 6554d5a2..21533fee 100644 --- a/vercel/resource_custom_environment.go +++ b/vercel/resource_custom_environment.go @@ -242,7 +242,7 @@ func (r *customEnvironmentResource) Create(ctx context.Context, req resource.Cre return } - tflog.Info(ctx, "created custom environment", map[string]interface{}{ + tflog.Info(ctx, "created custom environment", map[string]any{ "team_id": plan.TeamID.ValueString(), "project_id": plan.ProjectID.ValueString(), "custom_environment_id": res.ID, @@ -276,7 +276,7 @@ func (r *customEnvironmentResource) Read(ctx context.Context, req resource.ReadR ) return } - tflog.Trace(ctx, "read custom environment", map[string]interface{}{ + tflog.Trace(ctx, "read custom environment", map[string]any{ "team_id": state.TeamID.ValueString(), "project_id": state.ProjectID.ValueString(), "custom_environment_id": res.ID, @@ -309,7 +309,7 @@ func (r *customEnvironmentResource) Update(ctx context.Context, req resource.Upd return } - tflog.Trace(ctx, "created custom environment", map[string]interface{}{ + tflog.Trace(ctx, "created custom environment", map[string]any{ "team_id": plan.TeamID.ValueString(), "project_id": plan.ProjectID.ValueString(), "custom_environment_id": res.ID, @@ -368,7 +368,7 @@ func (r *customEnvironmentResource) ImportState(ctx context.Context, req resourc ) return } - tflog.Trace(ctx, "import custom environment", map[string]interface{}{ + tflog.Trace(ctx, "import custom environment", map[string]any{ "team_id": teamID, "project_id": projectID, "custom_environment_id": res.ID, diff --git a/vercel/resource_deployment.go b/vercel/resource_deployment.go index 4c8bb10e..3c19a23c 100644 --- a/vercel/resource_deployment.go +++ b/vercel/resource_deployment.go @@ -208,7 +208,7 @@ type Deployment struct { // setIfNotUnknown is a helper function to set a value in a map if it is not unknown. // Null values are set as nil, and actual values are set directly. -func setIfNotUnknown(m map[string]interface{}, v types.String, name string) { +func setIfNotUnknown(m map[string]any, v types.String, name string) { if v.IsNull() { m[name] = nil } @@ -219,8 +219,8 @@ func setIfNotUnknown(m map[string]interface{}, v types.String, name string) { // toRequest takes a set of ProjectSettings and converts them into the required // format for a CreateDeploymentRequest. -func (p *ProjectSettings) toRequest() map[string]interface{} { - res := map[string]interface{}{ +func (p *ProjectSettings) toRequest() map[string]any { + res := map[string]any{ /* Source files outside the root directory are required * for a monorepo style codebase. This allows a root_directory * to be set, but enables navigating upwards into a parent workspace. @@ -589,7 +589,7 @@ func (r *deploymentResource) Create(ctx context.Context, req resource.CreateRequ } result := convertResponseToDeployment(out, plan) - tflog.Info(ctx, "created deployment", map[string]interface{}{ + tflog.Info(ctx, "created deployment", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ID.ValueString(), }) @@ -629,7 +629,7 @@ func (r *deploymentResource) Read(ctx context.Context, req resource.ReadRequest, } result := convertResponseToDeployment(out, state) - tflog.Info(ctx, "read deployment", map[string]interface{}{ + tflog.Info(ctx, "read deployment", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ID.ValueString(), }) diff --git a/vercel/resource_dns_record.go b/vercel/resource_dns_record.go index 1844b3cc..ad80121c 100644 --- a/vercel/resource_dns_record.go +++ b/vercel/resource_dns_record.go @@ -379,7 +379,7 @@ func (r *dnsRecordResource) Create(ctx context.Context, req resource.CreateReque ) return } - tflog.Info(ctx, "created DNS Record", map[string]interface{}{ + tflog.Info(ctx, "created DNS Record", map[string]any{ "team_id": result.TeamID, "record_id": result.ID, "domain": result.Domain, @@ -427,7 +427,7 @@ func (r *dnsRecordResource) Read(ctx context.Context, req resource.ReadRequest, ) return } - tflog.Info(ctx, "read DNS record", map[string]interface{}{ + tflog.Info(ctx, "read DNS record", map[string]any{ "team_id": result.TeamID, "record_id": result.ID, "domain": result.Domain, @@ -483,7 +483,7 @@ func (r *dnsRecordResource) Update(ctx context.Context, req resource.UpdateReque ) return } - tflog.Info(ctx, "updated DNS record", map[string]interface{}{ + tflog.Info(ctx, "updated DNS record", map[string]any{ "team_id": result.TeamID, "record_id": result.ID, "domain": result.Domain, @@ -523,7 +523,7 @@ func (r *dnsRecordResource) Delete(ctx context.Context, req resource.DeleteReque return } - tflog.Info(ctx, "delete DNS record", map[string]interface{}{ + tflog.Info(ctx, "delete DNS record", map[string]any{ "domain": state.Domain, "record_id": state.ID, "team_id": state.TeamID, diff --git a/vercel/resource_edge_config.go b/vercel/resource_edge_config.go index 4dced5d0..76a8adc0 100644 --- a/vercel/resource_edge_config.go +++ b/vercel/resource_edge_config.go @@ -123,7 +123,7 @@ func (r *edgeConfigResource) Create(ctx context.Context, req resource.CreateRequ } result := responseToEdgeConfig(out) - tflog.Info(ctx, "created Edge Config", map[string]interface{}{ + tflog.Info(ctx, "created Edge Config", map[string]any{ "team_id": plan.TeamID.ValueString(), "edge_config_id": result.ID.ValueString(), }) @@ -163,7 +163,7 @@ func (r *edgeConfigResource) Read(ctx context.Context, req resource.ReadRequest, } result := responseToEdgeConfig(out) - tflog.Info(ctx, "read edge config", map[string]interface{}{ + tflog.Info(ctx, "read edge config", map[string]any{ "team_id": result.TeamID.ValueString(), "edge_config_id": result.ID.ValueString(), }) @@ -206,7 +206,7 @@ func (r *edgeConfigResource) Update(ctx context.Context, req resource.UpdateRequ } result := responseToEdgeConfig(out) - tflog.Trace(ctx, "update edge config", map[string]interface{}{ + tflog.Trace(ctx, "update edge config", map[string]any{ "team_id": result.TeamID.ValueString(), "edge_config_id": result.ID.ValueString(), }) @@ -244,7 +244,7 @@ func (r *edgeConfigResource) Delete(ctx context.Context, req resource.DeleteRequ return } - tflog.Info(ctx, "deleted Edge Config", map[string]interface{}{ + tflog.Info(ctx, "deleted Edge Config", map[string]any{ "team_id": state.TeamID.ValueString(), "edge_config_id": state.ID.ValueString(), }) @@ -277,7 +277,7 @@ func (r *edgeConfigResource) ImportState(ctx context.Context, req resource.Impor } result := responseToEdgeConfig(out) - tflog.Info(ctx, "import edge config", map[string]interface{}{ + tflog.Info(ctx, "import edge config", map[string]any{ "team_id": result.TeamID.ValueString(), "edge_config_id": result.ID.ValueString(), }) diff --git a/vercel/resource_edge_config_item.go b/vercel/resource_edge_config_item.go index bf7534bd..35d6adb5 100644 --- a/vercel/resource_edge_config_item.go +++ b/vercel/resource_edge_config_item.go @@ -126,7 +126,7 @@ func (r *edgeConfigItemResource) Create(ctx context.Context, req resource.Create } result := responseToEdgeConfigItem(out) - tflog.Info(ctx, "created Edge Config Item", map[string]interface{}{ + tflog.Info(ctx, "created Edge Config Item", map[string]any{ "edge_config_id": plan.EdgeConfigID.ValueString(), "key": result.Key.ValueString(), "value": result.Value.ValueString(), @@ -171,7 +171,7 @@ func (r *edgeConfigItemResource) Read(ctx context.Context, req resource.ReadRequ } result := responseToEdgeConfigItem(out) - tflog.Info(ctx, "read edge config token", map[string]interface{}{ + tflog.Info(ctx, "read edge config token", map[string]any{ "edge_config_id": state.EdgeConfigID.ValueString(), "team_id": state.TeamID.ValueString(), "key": state.Key.ValueString(), @@ -220,7 +220,7 @@ func (r *edgeConfigItemResource) Delete(ctx context.Context, req resource.Delete return } - tflog.Info(ctx, "deleted edge config token", map[string]interface{}{ + tflog.Info(ctx, "deleted edge config token", map[string]any{ "edge_config_id": state.EdgeConfigID.ValueString(), "team_id": state.TeamID.ValueString(), "key": state.Key.ValueString(), @@ -259,7 +259,7 @@ func (r *edgeConfigItemResource) ImportState(ctx context.Context, req resource.I } result := responseToEdgeConfigItem(out) - tflog.Info(ctx, "import edge config schema", map[string]interface{}{ + tflog.Info(ctx, "import edge config schema", map[string]any{ "team_id": result.TeamID.ValueString(), "edge_config_id": result.EdgeConfigID.ValueString(), "key": result.Key.ValueString(), diff --git a/vercel/resource_edge_config_schema.go b/vercel/resource_edge_config_schema.go index 6bbbd6bc..9deead00 100644 --- a/vercel/resource_edge_config_schema.go +++ b/vercel/resource_edge_config_schema.go @@ -130,7 +130,7 @@ func (r *edgeConfigSchemaResource) Create(ctx context.Context, req resource.Crea } result := responseToEdgeConfigSchema(out, plan.Definition) - tflog.Info(ctx, "created Edge Config Schema", map[string]interface{}{ + tflog.Info(ctx, "created Edge Config Schema", map[string]any{ "team_id": plan.TeamID.ValueString(), "edge_config_id": result.ID.ValueString(), }) @@ -170,7 +170,7 @@ func (r *edgeConfigSchemaResource) Read(ctx context.Context, req resource.ReadRe } result := responseToEdgeConfigSchema(out, state.Definition) - tflog.Info(ctx, "read edge config schema", map[string]interface{}{ + tflog.Info(ctx, "read edge config schema", map[string]any{ "team_id": result.TeamID.ValueString(), "edge_config_id": result.ID.ValueString(), }) @@ -213,7 +213,7 @@ func (r *edgeConfigSchemaResource) Update(ctx context.Context, req resource.Upda } result := responseToEdgeConfigSchema(out, plan.Definition) - tflog.Info(ctx, "created Edge Config Schema", map[string]interface{}{ + tflog.Info(ctx, "created Edge Config Schema", map[string]any{ "team_id": plan.TeamID.ValueString(), "edge_config_id": result.ID.ValueString(), }) @@ -251,7 +251,7 @@ func (r *edgeConfigSchemaResource) Delete(ctx context.Context, req resource.Dele return } - tflog.Info(ctx, "deleted edge config schema", map[string]interface{}{ + tflog.Info(ctx, "deleted edge config schema", map[string]any{ "team_id": state.TeamID.ValueString(), "edge_config_id": state.ID.ValueString(), }) @@ -294,7 +294,7 @@ func (r *edgeConfigSchemaResource) ImportState(ctx context.Context, req resource return } result := responseToEdgeConfigSchema(out, types.StringValue(string(def))) - tflog.Info(ctx, "import edge config schema", map[string]interface{}{ + tflog.Info(ctx, "import edge config schema", map[string]any{ "team_id": result.TeamID.ValueString(), "edge_config_id": result.ID.ValueString(), }) diff --git a/vercel/resource_edge_config_token.go b/vercel/resource_edge_config_token.go index a7bdbf50..01a56517 100644 --- a/vercel/resource_edge_config_token.go +++ b/vercel/resource_edge_config_token.go @@ -142,7 +142,7 @@ func (r *edgeConfigTokenResource) Create(ctx context.Context, req resource.Creat } result := responseToEdgeConfigToken(out) - tflog.Info(ctx, "created Edge Config Token", map[string]interface{}{ + tflog.Info(ctx, "created Edge Config Token", map[string]any{ "team_id": plan.TeamID.ValueString(), "edge_config_id": result.EdgeConfigID.ValueString(), "token_id": result.ID.ValueString(), @@ -187,7 +187,7 @@ func (r *edgeConfigTokenResource) Read(ctx context.Context, req resource.ReadReq } result := responseToEdgeConfigToken(out) - tflog.Info(ctx, "read edge config token", map[string]interface{}{ + tflog.Info(ctx, "read edge config token", map[string]any{ "team_id": result.TeamID.ValueString(), "edge_config_id": result.EdgeConfigID.ValueString(), "token_id": result.ID.ValueString(), @@ -239,7 +239,7 @@ func (r *edgeConfigTokenResource) Delete(ctx context.Context, req resource.Delet return } - tflog.Info(ctx, "deleted edge config token", map[string]interface{}{ + tflog.Info(ctx, "deleted edge config token", map[string]any{ "team_id": state.TeamID.ValueString(), "edge_config_id": state.EdgeConfigID.ValueString(), "token_id": state.ID.ValueString(), @@ -278,7 +278,7 @@ func (r *edgeConfigTokenResource) ImportState(ctx context.Context, req resource. } result := responseToEdgeConfigToken(out) - tflog.Info(ctx, "import edge config token", map[string]interface{}{ + tflog.Info(ctx, "import edge config token", map[string]any{ "team_id": result.TeamID.ValueString(), "edge_config_id": result.EdgeConfigID.ValueString(), "token_id": result.ID.ValueString(), diff --git a/vercel/resource_firewall_bypass.go b/vercel/resource_firewall_bypass.go index fdad8949..feeca4be 100644 --- a/vercel/resource_firewall_bypass.go +++ b/vercel/resource_firewall_bypass.go @@ -137,7 +137,7 @@ func (r *firewallBypassResource) Create(ctx context.Context, req resource.Create } result := responseToBypassRule(out) - tflog.Info(ctx, "created firewall bypass rule", map[string]interface{}{ + tflog.Info(ctx, "created firewall bypass rule", map[string]any{ "team_id": plan.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) @@ -183,7 +183,7 @@ func (r *firewallBypassResource) Read(ctx context.Context, req resource.ReadRequ } result := responseToBypassRule(out) - tflog.Info(ctx, "read firewall bypass rule", map[string]interface{}{ + tflog.Info(ctx, "read firewall bypass rule", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) @@ -238,7 +238,7 @@ func (r *firewallBypassResource) Delete(ctx context.Context, req resource.Delete return } - tflog.Info(ctx, "deleted firewall bypass rule", map[string]interface{}{ + tflog.Info(ctx, "deleted firewall bypass rule", map[string]any{ "team_id": state.TeamID.ValueString(), "project_id": state.ProjectID.ValueString(), }) @@ -297,7 +297,7 @@ func (r *firewallBypassResource) ImportState(ctx context.Context, req resource.I } result := responseToBypassRule(out) - tflog.Info(ctx, "import firewall bypass", map[string]interface{}{ + tflog.Info(ctx, "import firewall bypass", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) diff --git a/vercel/resource_firewall_config.go b/vercel/resource_firewall_config.go index 8d43cad6..e6406c91 100644 --- a/vercel/resource_firewall_config.go +++ b/vercel/resource_firewall_config.go @@ -709,7 +709,7 @@ func fromCondition(condition client.Condition, ref Condition) (Condition, error) Values: types.ListNull(types.StringType), } if isListOp(condition.Op) { - if valueList, ok := condition.Value.([]interface{}); ok { + if valueList, ok := condition.Value.([]any); ok { values, diags := basetypes.NewListValueFrom(context.Background(), types.StringType, valueList) if diags.HasError() { return c, fmt.Errorf("error converting values: %s - %s", diags[0].Summary(), diags[0].Detail()) @@ -1016,7 +1016,7 @@ func (r *firewallConfigResource) Delete(ctx context.Context, req resource.Delete resp.Diagnostics.AddError("failed to delete firewall config", err.Error()) return } - tflog.Info(ctx, "deleted firewall config", map[string]interface{}{ + tflog.Info(ctx, "deleted firewall config", map[string]any{ "project_id": state.ProjectID.ValueString(), "team_id": state.TeamID.ValueString(), }) @@ -1043,7 +1043,7 @@ func (r *firewallConfigResource) ImportState(ctx context.Context, req resource.I resp.Diagnostics.AddError("failed to read firewall config", err.Error()) return } - tflog.Info(ctx, "imported firewall config", map[string]interface{}{ + tflog.Info(ctx, "imported firewall config", map[string]any{ "team_id": conf.TeamID.ValueString(), "project_id": conf.ProjectID.ValueString(), }) diff --git a/vercel/resource_integration_project_access.go b/vercel/resource_integration_project_access.go index c66fcb78..5d69c449 100644 --- a/vercel/resource_integration_project_access.go +++ b/vercel/resource_integration_project_access.go @@ -103,7 +103,7 @@ func (r *integrationProjectAccessResource) Create(ctx context.Context, req resou ProjectID: plan.ProjectID, } - tflog.Info(ctx, "granted integration project access", map[string]interface{}{ + tflog.Info(ctx, "granted integration project access", map[string]any{ "team_id": result.TeamID.ValueString(), "integration_id": result.IntegrationID.ValueString(), "project_id": result.ProjectID.ValueString(), @@ -138,7 +138,7 @@ func (r *integrationProjectAccessResource) Read(ctx context.Context, req resourc IntegrationID: state.IntegrationID, ProjectID: state.ProjectID, } - tflog.Info(ctx, "read integration project access", map[string]interface{}{ + tflog.Info(ctx, "read integration project access", map[string]any{ "team_id": result.TeamID.ValueString(), "integration_id": result.IntegrationID.ValueString(), "project_id": result.ProjectID.ValueString(), @@ -183,7 +183,7 @@ func (r *integrationProjectAccessResource) Delete(ctx context.Context, req resou ProjectID: plan.ProjectID, } - tflog.Info(ctx, "revoked integration project access", map[string]interface{}{ + tflog.Info(ctx, "revoked integration project access", map[string]any{ "team_id": result.TeamID.ValueString(), "integration_id": result.IntegrationID.ValueString(), "project_id": result.ProjectID.ValueString(), diff --git a/vercel/resource_log_drain.go b/vercel/resource_log_drain.go index fc9b4155..aa8c3739 100644 --- a/vercel/resource_log_drain.go +++ b/vercel/resource_log_drain.go @@ -266,7 +266,7 @@ func (r *logDrainResource) Create(ctx context.Context, req resource.CreateReques if resp.Diagnostics.HasError() { return } - tflog.Info(ctx, "created Log Drain", map[string]interface{}{ + tflog.Info(ctx, "created Log Drain", map[string]any{ "team_id": plan.TeamID.ValueString(), "log_drain_id": result.ID.ValueString(), }) @@ -308,7 +308,7 @@ func (r *logDrainResource) Read(ctx context.Context, req resource.ReadRequest, r if resp.Diagnostics.HasError() { return } - tflog.Info(ctx, "read log drain", map[string]interface{}{ + tflog.Info(ctx, "read log drain", map[string]any{ "team_id": result.TeamID.ValueString(), "log_drain_id": result.ID.ValueString(), }) @@ -352,7 +352,7 @@ func (r *logDrainResource) Delete(ctx context.Context, req resource.DeleteReques return } - tflog.Info(ctx, "deleted Log Drain", map[string]interface{}{ + tflog.Info(ctx, "deleted Log Drain", map[string]any{ "team_id": state.TeamID.ValueString(), "log_drain_id": state.ID.ValueString(), }) @@ -389,7 +389,7 @@ func (r *logDrainResource) ImportState(ctx context.Context, req resource.ImportS if resp.Diagnostics.HasError() { return } - tflog.Info(ctx, "import log drain", map[string]interface{}{ + tflog.Info(ctx, "import log drain", map[string]any{ "team_id": result.TeamID.ValueString(), "log_drain_id": result.ID.ValueString(), }) diff --git a/vercel/resource_microfrontend_group.go b/vercel/resource_microfrontend_group.go index 1917beee..e0f04ef9 100644 --- a/vercel/resource_microfrontend_group.go +++ b/vercel/resource_microfrontend_group.go @@ -56,7 +56,7 @@ func (r *microfrontendGroupResource) Schema(_ context.Context, req resource.Sche Description: ` Provides a Microfrontend Group resource. -A Microfrontend Group is a definition of a microfrontend belonging to a Vercel Team. +A Microfrontend Group is a definition of a microfrontend belonging to a Vercel Team. `, Attributes: map[string]schema.Attribute{ "name": schema.StringAttribute{ @@ -140,7 +140,7 @@ func (r *microfrontendGroupResource) Create(ctx context.Context, req resource.Cr return } - tflog.Info(ctx, "creating microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "creating microfrontend group", map[string]any{ "team_id": plan.TeamID.ValueString(), "name": plan.Name.ValueString(), }) @@ -154,7 +154,7 @@ func (r *microfrontendGroupResource) Create(ctx context.Context, req resource.Cr return } - tflog.Info(ctx, "creating default group membership", map[string]interface{}{ + tflog.Info(ctx, "creating default group membership", map[string]any{ "team_id": plan.TeamID.ValueString(), "name": plan.Name.ValueString(), "default_app": plan.DefaultApp.ProjectID.ValueString(), @@ -193,7 +193,7 @@ func (r *microfrontendGroupResource) Create(ctx context.Context, req resource.Cr } result := convertResponseToMicrofrontendGroup(group) - tflog.Info(ctx, "created microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "created microfrontend group", map[string]any{ "team_id": result.TeamID.ValueString(), "group_id": result.ID.ValueString(), "slug": result.Slug.ValueString(), @@ -234,7 +234,7 @@ func (r *microfrontendGroupResource) Read(ctx context.Context, req resource.Read } result := convertResponseToMicrofrontendGroup(out) - tflog.Info(ctx, "read microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "read microfrontend group", map[string]any{ "defaultApp": result.DefaultApp.ProjectID.ValueString(), "team_id": result.TeamID.ValueString(), "group_id": result.ID.ValueString(), @@ -286,7 +286,7 @@ func (r *microfrontendGroupResource) Update(ctx context.Context, req resource.Up return } - tflog.Info(ctx, "updated microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "updated microfrontend group", map[string]any{ "team_id": out.TeamID, "group_id": out.ID, "name": out.Name, @@ -310,7 +310,7 @@ func (r *microfrontendGroupResource) Delete(ctx context.Context, req resource.De return } - tflog.Info(ctx, "deleting microfrontend default app group membership", map[string]interface{}{ + tflog.Info(ctx, "deleting microfrontend default app group membership", map[string]any{ "group_id": state.ID.ValueString(), "project_id": state.DefaultApp.ProjectID.ValueString(), "team_id": state.TeamID.ValueString(), @@ -335,7 +335,7 @@ func (r *microfrontendGroupResource) Delete(ctx context.Context, req resource.De return } - tflog.Info(ctx, "deleting microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "deleting microfrontend group", map[string]any{ "group_id": state.ID.ValueString(), }) @@ -387,7 +387,7 @@ func (r *microfrontendGroupResource) ImportState(ctx context.Context, req resour } result := convertResponseToMicrofrontendGroup(out) - tflog.Info(ctx, "import microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "import microfrontend group", map[string]any{ "defaultApp": result.DefaultApp.ProjectID.ValueString(), "team_id": result.TeamID.ValueString(), "group_id": result.ID.ValueString(), diff --git a/vercel/resource_microfrontend_group_membership.go b/vercel/resource_microfrontend_group_membership.go index 0f403374..aa598789 100644 --- a/vercel/resource_microfrontend_group_membership.go +++ b/vercel/resource_microfrontend_group_membership.go @@ -96,7 +96,7 @@ func (r *microfrontendGroupMembershipResource) Schema(_ context.Context, req res Description: ` Provides a Microfrontend Group Membership resource. -A Microfrontend Group Membership is a definition of a Vercel Project being a part of a Microfrontend Group. +A Microfrontend Group Membership is a definition of a Vercel Project being a part of a Microfrontend Group. `, Attributes: getMicrofrontendGroupMembershipSchema(false), } @@ -132,7 +132,7 @@ func (r *microfrontendGroupMembershipResource) Create(ctx context.Context, req r return } - tflog.Info(ctx, "creating microfrontend group membership", map[string]interface{}{ + tflog.Info(ctx, "creating microfrontend group membership", map[string]any{ "project_id": plan.ProjectID.ValueString(), "group_id": plan.MicrofrontendGroupID.ValueString(), "plan": plan, @@ -155,7 +155,7 @@ func (r *microfrontendGroupMembershipResource) Create(ctx context.Context, req r } result := convertResponseToMicrofrontendGroupMembership(out) - tflog.Info(ctx, "created microfrontend group membership", map[string]interface{}{ + tflog.Info(ctx, "created microfrontend group membership", map[string]any{ "project_id": result.ProjectID.ValueString(), "group_id": result.MicrofrontendGroupID.ValueString(), }) @@ -202,7 +202,7 @@ func (r *microfrontendGroupMembershipResource) Read(ctx context.Context, req res } result := convertResponseToMicrofrontendGroupMembership(out) - tflog.Info(ctx, "read microfrontend group membership", map[string]interface{}{ + tflog.Info(ctx, "read microfrontend group membership", map[string]any{ "team_id": result.TeamID.ValueString(), "group_id": result.MicrofrontendGroupID.ValueString(), "project_id": result.ProjectID.ValueString(), @@ -256,7 +256,7 @@ func (r *microfrontendGroupMembershipResource) Update(ctx context.Context, req r return } - tflog.Info(ctx, "updated microfrontend group membership", map[string]interface{}{ + tflog.Info(ctx, "updated microfrontend group membership", map[string]any{ "team_id": out.TeamID, "microfrontend_group_id": out.MicrofrontendGroupID, "project_id": out.ProjectID, @@ -279,7 +279,7 @@ func (r *microfrontendGroupMembershipResource) Delete(ctx context.Context, req r return } - tflog.Info(ctx, "deleting microfrontend group membership", map[string]interface{}{ + tflog.Info(ctx, "deleting microfrontend group membership", map[string]any{ "project_id": state.ProjectID.ValueString(), "group_id": state.MicrofrontendGroupID.ValueString(), "team_id": state.TeamID.ValueString(), @@ -336,7 +336,7 @@ func (r *microfrontendGroupMembershipResource) ImportState(ctx context.Context, } result := convertResponseToMicrofrontendGroupMembership(out) - tflog.Info(ctx, "import microfrontend group", map[string]interface{}{ + tflog.Info(ctx, "import microfrontend group", map[string]any{ "project_id": result.ProjectID.ValueString(), "group_id": result.MicrofrontendGroupID.ValueString(), "team_id": result.TeamID.ValueString(), diff --git a/vercel/resource_project.go b/vercel/resource_project.go index 72a353b6..2d5a0833 100644 --- a/vercel/resource_project.go +++ b/vercel/resource_project.go @@ -1513,7 +1513,7 @@ func (r *projectResource) Create(ctx context.Context, req resource.CreateRequest ) return } - tflog.Info(ctx, "created project", map[string]interface{}{ + tflog.Info(ctx, "created project", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ID.ValueString(), }) @@ -1586,7 +1586,7 @@ func (r *projectResource) Create(ctx context.Context, req resource.CreateRequest ) return } - tflog.Info(ctx, "updated newly created project", map[string]interface{}{ + tflog.Info(ctx, "updated newly created project", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ID.ValueString(), }) @@ -1645,7 +1645,7 @@ func (r *projectResource) Create(ctx context.Context, req resource.CreateRequest ) return } - tflog.Info(ctx, "updated project production branch", map[string]interface{}{ + tflog.Info(ctx, "updated project production branch", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ID.ValueString(), }) @@ -1700,7 +1700,7 @@ func (r *projectResource) Read(ctx context.Context, req resource.ReadRequest, re ) return } - tflog.Info(ctx, "read project", map[string]interface{}{ + tflog.Info(ctx, "read project", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ID.ValueString(), }) @@ -1824,7 +1824,7 @@ func (r *projectResource) Update(ctx context.Context, req resource.UpdateRequest return } - tflog.Info(ctx, "planEnvs", map[string]interface{}{ + tflog.Info(ctx, "planEnvs", map[string]any{ "plan_envs": planEnvs, "state_envs": stateEnvs, }) @@ -1844,7 +1844,7 @@ func (r *projectResource) Update(ctx context.Context, req resource.UpdateRequest ) return } - tflog.Info(ctx, "deleted environment variable", map[string]interface{}{ + tflog.Info(ctx, "deleted environment variable", map[string]any{ "team_id": plan.TeamID.ValueString(), "project_id": plan.ID.ValueString(), "environment_id": v.ID.ValueString(), @@ -1880,7 +1880,7 @@ func (r *projectResource) Update(ctx context.Context, req resource.UpdateRequest ), ) } - tflog.Info(ctx, "upserted environment variables", map[string]interface{}{ + tflog.Info(ctx, "upserted environment variables", map[string]any{ "team_id": plan.TeamID.ValueString(), "project_id": plan.ID.ValueString(), }) @@ -2076,7 +2076,7 @@ func (r *projectResource) Update(ctx context.Context, req resource.UpdateRequest ) return } - tflog.Info(ctx, "updated project", map[string]interface{}{ + tflog.Info(ctx, "updated project", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ID.ValueString(), }) @@ -2115,7 +2115,7 @@ func (r *projectResource) Delete(ctx context.Context, req resource.DeleteRequest return } - tflog.Info(ctx, "deleted project", map[string]interface{}{ + tflog.Info(ctx, "deleted project", map[string]any{ "team_id": state.TeamID.ValueString(), "project_id": state.ID.ValueString(), }) @@ -2161,7 +2161,7 @@ func (r *projectResource) ImportState(ctx context.Context, req resource.ImportSt ) return } - tflog.Info(ctx, "imported project", map[string]interface{}{ + tflog.Info(ctx, "imported project", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ID.ValueString(), }) diff --git a/vercel/resource_project_deployment_retention.go b/vercel/resource_project_deployment_retention.go index a43160ca..fac33bfc 100644 --- a/vercel/resource_project_deployment_retention.go +++ b/vercel/resource_project_deployment_retention.go @@ -188,7 +188,7 @@ func (r *projectDeploymentRetentionResource) Create(ctx context.Context, req res result := convertResponseToProjectDeploymentRetention(response, plan.ProjectID, plan.TeamID) - tflog.Info(ctx, "created project deployment retention", map[string]interface{}{ + tflog.Info(ctx, "created project deployment retention", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) @@ -228,7 +228,7 @@ func (r *projectDeploymentRetentionResource) Read(ctx context.Context, req resou } result := convertResponseToProjectDeploymentRetention(out, state.ProjectID, state.TeamID) - tflog.Info(ctx, "read project deployment retention", map[string]interface{}{ + tflog.Info(ctx, "read project deployment retention", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) @@ -265,7 +265,7 @@ func (r *projectDeploymentRetentionResource) Delete(ctx context.Context, req res return } - tflog.Info(ctx, "deleted project deployment retention", map[string]interface{}{ + tflog.Info(ctx, "deleted project deployment retention", map[string]any{ "team_id": state.TeamID.ValueString(), "project_id": state.ProjectID.ValueString(), }) @@ -291,7 +291,7 @@ func (r *projectDeploymentRetentionResource) Update(ctx context.Context, req res result := convertResponseToProjectDeploymentRetention(response, plan.ProjectID, plan.TeamID) - tflog.Info(ctx, "updated project deployment retention", map[string]interface{}{ + tflog.Info(ctx, "updated project deployment retention", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) @@ -328,7 +328,7 @@ func (r *projectDeploymentRetentionResource) ImportState(ctx context.Context, re } result := convertResponseToProjectDeploymentRetention(out, types.StringValue(projectID), types.StringValue(teamID)) - tflog.Info(ctx, "imported project deployment retention", map[string]interface{}{ + tflog.Info(ctx, "imported project deployment retention", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) diff --git a/vercel/resource_project_domain.go b/vercel/resource_project_domain.go index 98019d9f..3594f2ce 100644 --- a/vercel/resource_project_domain.go +++ b/vercel/resource_project_domain.go @@ -208,7 +208,7 @@ func (r *projectDomainResource) Create(ctx context.Context, req resource.CreateR } result := convertResponseToProjectDomain(out) - tflog.Info(ctx, "added domain to project", map[string]interface{}{ + tflog.Info(ctx, "added domain to project", map[string]any{ "project_id": result.ProjectID.ValueString(), "domain": result.Domain.ValueString(), "team_id": result.TeamID.ValueString(), @@ -249,7 +249,7 @@ func (r *projectDomainResource) Read(ctx context.Context, req resource.ReadReque } result := convertResponseToProjectDomain(out) - tflog.Info(ctx, "read project domain", map[string]interface{}{ + tflog.Info(ctx, "read project domain", map[string]any{ "project_id": result.ProjectID.ValueString(), "domain": result.Domain.ValueString(), "team_id": result.TeamID.ValueString(), @@ -291,7 +291,7 @@ func (r *projectDomainResource) Update(ctx context.Context, req resource.UpdateR } result := convertResponseToProjectDomain(out) - tflog.Info(ctx, "update project domain", map[string]interface{}{ + tflog.Info(ctx, "update project domain", map[string]any{ "project_id": result.ProjectID.ValueString(), "domain": result.Domain.ValueString(), "team_id": result.TeamID.ValueString(), @@ -332,7 +332,7 @@ func (r *projectDomainResource) Delete(ctx context.Context, req resource.DeleteR return } - tflog.Info(ctx, "delete project domain", map[string]interface{}{ + tflog.Info(ctx, "delete project domain", map[string]any{ "project_id": state.ProjectID.ValueString(), "domain": state.Domain.ValueString(), "team_id": state.TeamID.ValueString(), @@ -364,7 +364,7 @@ func (r *projectDomainResource) ImportState(ctx context.Context, req resource.Im } result := convertResponseToProjectDomain(out) - tflog.Info(ctx, "imported project domain", map[string]interface{}{ + tflog.Info(ctx, "imported project domain", map[string]any{ "project_id": result.ProjectID.ValueString(), "domain": result.Domain.ValueString(), "team_id": result.TeamID.ValueString(), diff --git a/vercel/resource_project_environment_variable.go b/vercel/resource_project_environment_variable.go index 33b65254..cc7c9051 100644 --- a/vercel/resource_project_environment_variable.go +++ b/vercel/resource_project_environment_variable.go @@ -341,7 +341,7 @@ func (r *projectEnvironmentVariableResource) Create(ctx context.Context, req res result := convertResponseToProjectEnvironmentVariable(response, plan.ProjectID, plan.Value) - tflog.Info(ctx, "created project environment variable", map[string]interface{}{ + tflog.Info(ctx, "created project environment variable", map[string]any{ "id": result.ID.ValueString(), "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), @@ -383,7 +383,7 @@ func (r *projectEnvironmentVariableResource) Read(ctx context.Context, req resou } result := convertResponseToProjectEnvironmentVariable(out, state.ProjectID, state.Value) - tflog.Info(ctx, "read project environment variable", map[string]interface{}{ + tflog.Info(ctx, "read project environment variable", map[string]any{ "id": result.ID.ValueString(), "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), @@ -421,7 +421,7 @@ func (r *projectEnvironmentVariableResource) Update(ctx context.Context, req res result := convertResponseToProjectEnvironmentVariable(response, plan.ProjectID, plan.Value) - tflog.Info(ctx, "updated project environment variable", map[string]interface{}{ + tflog.Info(ctx, "updated project environment variable", map[string]any{ "id": result.ID.ValueString(), "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), @@ -459,7 +459,7 @@ func (r *projectEnvironmentVariableResource) Delete(ctx context.Context, req res return } - tflog.Info(ctx, "deleted project environment variable", map[string]interface{}{ + tflog.Info(ctx, "deleted project environment variable", map[string]any{ "id": state.ID.ValueString(), "team_id": state.TeamID.ValueString(), "project_id": state.ProjectID.ValueString(), @@ -492,7 +492,7 @@ func (r *projectEnvironmentVariableResource) ImportState(ctx context.Context, re } result := convertResponseToProjectEnvironmentVariable(out, types.StringValue(projectID), types.StringNull()) - tflog.Info(ctx, "imported project environment variable", map[string]interface{}{ + tflog.Info(ctx, "imported project environment variable", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), "env_id": result.ID.ValueString(), diff --git a/vercel/resource_project_environment_variables.go b/vercel/resource_project_environment_variables.go index d52c23f7..727e2604 100644 --- a/vercel/resource_project_environment_variables.go +++ b/vercel/resource_project_environment_variables.go @@ -412,7 +412,7 @@ func (r *projectEnvironmentVariablesResource) Create(ctx context.Context, req re return } - tflog.Info(ctx, "created project environment variables", map[string]interface{}{ + tflog.Info(ctx, "created project environment variables", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), "variables": created, @@ -477,7 +477,7 @@ func (r *projectEnvironmentVariablesResource) Read(ctx context.Context, req reso return } - tflog.Info(ctx, "read project environment variables", map[string]interface{}{ + tflog.Info(ctx, "read project environment variables", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) @@ -541,8 +541,8 @@ func (r *projectEnvironmentVariablesResource) Update(ctx context.Context, req re unchanged = append(unchanged, e) } - tflog.Info(ctx, "Removing environment variables", map[string]interface{}{"to_remove": toRemove}) - tflog.Info(ctx, "Adding environment variables", map[string]interface{}{"to_add": toAdd}) + tflog.Info(ctx, "Removing environment variables", map[string]any{"to_remove": toRemove}) + tflog.Info(ctx, "Adding environment variables", map[string]any{"to_add": toAdd}) for _, v := range toRemove { err := r.client.DeleteEnvironmentVariable(ctx, state.ProjectID.ValueString(), state.TeamID.ValueString(), v.ID.ValueString()) @@ -558,7 +558,7 @@ func (r *projectEnvironmentVariablesResource) Update(ctx context.Context, req re ) return } - tflog.Info(ctx, "deleted environment variable", map[string]interface{}{ + tflog.Info(ctx, "deleted environment variable", map[string]any{ "team_id": plan.TeamID.ValueString(), "project_id": plan.ProjectID.ValueString(), "environment_id": v.ID.ValueString(), @@ -596,7 +596,7 @@ func (r *projectEnvironmentVariablesResource) Update(ctx context.Context, req re return } - tflog.Info(ctx, "updated project environment variables", map[string]interface{}{ + tflog.Info(ctx, "updated project environment variables", map[string]any{ "team_id": result.TeamID.ValueString(), "project_id": result.ProjectID.ValueString(), }) @@ -636,7 +636,7 @@ func (r *projectEnvironmentVariablesResource) Delete(ctx context.Context, req re ) return } - tflog.Info(ctx, "deleted environment variable", map[string]interface{}{ + tflog.Info(ctx, "deleted environment variable", map[string]any{ "team_id": state.TeamID.ValueString(), "project_id": state.ProjectID.ValueString(), "environment_id": v.ID.ValueString(), diff --git a/vercel/resource_project_members.go b/vercel/resource_project_members.go index e6a3ed82..46e33a3b 100644 --- a/vercel/resource_project_members.go +++ b/vercel/resource_project_members.go @@ -208,7 +208,7 @@ func (r *projectMembersResource) Create(ctx context.Context, req resource.Create TeamID: plan.TeamID.ValueString(), ProjectID: plan.ProjectID.ValueString(), }) - tflog.Trace(ctx, "read project members", map[string]interface{}{ + tflog.Trace(ctx, "read project members", map[string]any{ "team_id": plan.TeamID.ValueString(), "project_id": plan.ProjectID.ValueString(), "members": members, @@ -384,7 +384,7 @@ func (r *projectMembersResource) Update(ctx context.Context, req resource.Update } toAdd, toRemove, toUpdate := diffMembers(stateMembers, plannedMembers) - tflog.Info(ctx, "update project members", map[string]interface{}{ + tflog.Info(ctx, "update project members", map[string]any{ "toAdd": toAdd, "toRemove": toRemove, "toUpdate": toUpdate, @@ -462,7 +462,7 @@ func (r *projectMembersResource) Update(ctx context.Context, req resource.Update TeamID: state.TeamID.ValueString(), ProjectID: state.ProjectID.ValueString(), }) - tflog.Info(ctx, "read project members", map[string]interface{}{ + tflog.Info(ctx, "read project members", map[string]any{ "team_id": state.TeamID.ValueString(), "project_id": state.ProjectID.ValueString(), "members": members, diff --git a/vercel/resource_shared_environment_variable.go b/vercel/resource_shared_environment_variable.go index f369e43d..973ce172 100644 --- a/vercel/resource_shared_environment_variable.go +++ b/vercel/resource_shared_environment_variable.go @@ -304,7 +304,7 @@ func (r *sharedEnvironmentVariableResource) Create(ctx context.Context, req reso result := convertResponseToSharedEnvironmentVariable(response, plan.Value) - tflog.Info(ctx, "created shared environment variable", map[string]interface{}{ + tflog.Info(ctx, "created shared environment variable", map[string]any{ "id": result.ID.ValueString(), "team_id": result.TeamID.ValueString(), }) @@ -344,7 +344,7 @@ func (r *sharedEnvironmentVariableResource) Read(ctx context.Context, req resour } result := convertResponseToSharedEnvironmentVariable(out, state.Value) - tflog.Info(ctx, "read shared environment variable", map[string]interface{}{ + tflog.Info(ctx, "read shared environment variable", map[string]any{ "id": result.ID.ValueString(), "team_id": result.TeamID.ValueString(), }) @@ -379,7 +379,7 @@ func (r *sharedEnvironmentVariableResource) Update(ctx context.Context, req reso result := convertResponseToSharedEnvironmentVariable(response, plan.Value) - tflog.Info(ctx, "updated shared environment variable", map[string]interface{}{ + tflog.Info(ctx, "updated shared environment variable", map[string]any{ "id": result.ID.ValueString(), "team_id": result.TeamID.ValueString(), }) @@ -416,7 +416,7 @@ func (r *sharedEnvironmentVariableResource) Delete(ctx context.Context, req reso return } - tflog.Info(ctx, "deleted shared environment variable", map[string]interface{}{ + tflog.Info(ctx, "deleted shared environment variable", map[string]any{ "id": state.ID.ValueString(), "team_id": state.TeamID.ValueString(), }) @@ -447,7 +447,7 @@ func (r *sharedEnvironmentVariableResource) ImportState(ctx context.Context, req } result := convertResponseToSharedEnvironmentVariable(out, types.StringNull()) - tflog.Info(ctx, "imported shared environment variable", map[string]interface{}{ + tflog.Info(ctx, "imported shared environment variable", map[string]any{ "team_id": result.TeamID.ValueString(), "env_id": result.ID.ValueString(), }) diff --git a/vercel/resource_shared_environment_variable_project_link.go b/vercel/resource_shared_environment_variable_project_link.go index 86aa391d..35e4ac6d 100644 --- a/vercel/resource_shared_environment_variable_project_link.go +++ b/vercel/resource_shared_environment_variable_project_link.go @@ -126,7 +126,7 @@ func (r *sharedEnvironmentVariableProjectLinkResource) Create(ctx context.Contex ProjectID: plan.ProjectID, } - tflog.Info(ctx, "linked shared environment variable to project", map[string]interface{}{ + tflog.Info(ctx, "linked shared environment variable to project", map[string]any{ "team_id": result.TeamID.ValueString(), "shared_environment_variable_id": result.SharedEnvironmentVariableID.ValueString(), "project_id": result.ProjectID.ValueString(), @@ -157,7 +157,7 @@ func (r *sharedEnvironmentVariableProjectLinkResource) Read(ctx context.Context, } if !slices.Contains(response.ProjectIDs, state.ProjectID.ValueString()) { - tflog.Info(ctx, "failed to read shared environment variable for linked project", map[string]interface{}{ + tflog.Info(ctx, "failed to read shared environment variable for linked project", map[string]any{ "team_id": state.TeamID.ValueString(), "shared_environment_variable_id": state.SharedEnvironmentVariableID.ValueString(), "project_id": state.ProjectID.ValueString(), @@ -173,7 +173,7 @@ func (r *sharedEnvironmentVariableProjectLinkResource) Read(ctx context.Context, SharedEnvironmentVariableID: types.StringValue(response.ID), ProjectID: state.ProjectID, } - tflog.Info(ctx, "read shared environment variable for linked project", map[string]interface{}{ + tflog.Info(ctx, "read shared environment variable for linked project", map[string]any{ "team_id": result.TeamID.ValueString(), "shared_environment_variable_id": result.SharedEnvironmentVariableID.ValueString(), "project_id": result.ProjectID.ValueString(), @@ -214,7 +214,7 @@ func (r *sharedEnvironmentVariableProjectLinkResource) Delete(ctx context.Contex ProjectID: plan.ProjectID, } - tflog.Info(ctx, "project unlinked from shared environment", map[string]interface{}{ + tflog.Info(ctx, "project unlinked from shared environment", map[string]any{ "team_id": result.TeamID.ValueString(), "shared_environment_variable_id": result.SharedEnvironmentVariableID.ValueString(), "project_id": result.ProjectID.ValueString(), diff --git a/vercel/resource_team_config.go b/vercel/resource_team_config.go index 6625946d..07d79c8c 100644 --- a/vercel/resource_team_config.go +++ b/vercel/resource_team_config.go @@ -479,7 +479,7 @@ func (r *teamConfigResource) Create(ctx context.Context, req resource.CreateRequ } jsonResp, _ := json.Marshal(response) - tflog.Info(ctx, "created Team Configuration", map[string]interface{}{ + tflog.Info(ctx, "created Team Configuration", map[string]any{ "team_id": response.ID, "response": string(jsonResp), }) @@ -560,7 +560,7 @@ func (r *teamConfigResource) Update(ctx context.Context, req resource.UpdateRequ return } - tflog.Info(ctx, "updated Team configuration", map[string]interface{}{ + tflog.Info(ctx, "updated Team configuration", map[string]any{ "team_id": response.ID, }) diff --git a/vercel/resource_team_member.go b/vercel/resource_team_member.go index 0a1c5580..61c45b0f 100644 --- a/vercel/resource_team_member.go +++ b/vercel/resource_team_member.go @@ -298,7 +298,7 @@ func (r *teamMemberResource) Create(ctx context.Context, req resource.CreateRequ return } - tflog.Info(ctx, "invited Team Member", map[string]interface{}{ + tflog.Info(ctx, "invited Team Member", map[string]any{ "team_id": plan.TeamID.ValueString(), "user_id": plan.UserID.ValueString(), }) @@ -398,7 +398,7 @@ func (r *teamMemberResource) Update(ctx context.Context, req resource.UpdateRequ return } - tflog.Info(ctx, "updated Team member", map[string]interface{}{ + tflog.Info(ctx, "updated Team member", map[string]any{ "team_id": request.TeamID, "user_id": request.UserID, }) @@ -456,7 +456,7 @@ func (r *teamMemberResource) ImportState(ctx context.Context, req resource.Impor ) } - tflog.Info(ctx, "import Team Member", map[string]interface{}{ + tflog.Info(ctx, "import Team Member", map[string]any{ "team_id": teamID, "user_id": userID, }) diff --git a/vercel/resource_webhook.go b/vercel/resource_webhook.go index 2624be2c..200268e9 100644 --- a/vercel/resource_webhook.go +++ b/vercel/resource_webhook.go @@ -182,7 +182,7 @@ func (r *webhookResource) Create(ctx context.Context, req resource.CreateRequest if resp.Diagnostics.HasError() { return } - tflog.Info(ctx, "created webhook", map[string]interface{}{ + tflog.Info(ctx, "created webhook", map[string]any{ "team_id": plan.TeamID.ValueString(), "webhook_id": result.ID.ValueString(), }) @@ -228,7 +228,7 @@ func (r *webhookResource) Read(ctx context.Context, req resource.ReadRequest, re if resp.Diagnostics.HasError() { return } - tflog.Info(ctx, "read webhook", map[string]interface{}{ + tflog.Info(ctx, "read webhook", map[string]any{ "team_id": result.TeamID.ValueString(), "webhook_id": result.ID.ValueString(), }) @@ -273,7 +273,7 @@ func (r *webhookResource) Delete(ctx context.Context, req resource.DeleteRequest return } - tflog.Info(ctx, "deleted Webhook", map[string]interface{}{ + tflog.Info(ctx, "deleted Webhook", map[string]any{ "team_id": state.TeamID.ValueString(), "webhook_id": state.ID.ValueString(), }) diff --git a/vercel/validator_json_string.go b/vercel/validator_json_string.go index e2836df0..3072e086 100644 --- a/vercel/validator_json_string.go +++ b/vercel/validator_json_string.go @@ -29,7 +29,7 @@ func (v validatorJSON) ValidateString(ctx context.Context, req validator.StringR return } - var i interface{} + var i any if err := json.Unmarshal([]byte(req.ConfigValue.ValueString()), &i); err != nil { resp.Diagnostics.AddAttributeError( req.Path, From b55edfb7248c94794460e3a7e3be0ac68ca3f277 Mon Sep 17 00:00:00 2001 From: Douglas Harcourt Parsons Date: Thu, 6 Mar 2025 12:26:03 +0000 Subject: [PATCH 2/5] Support adding team_members by email address --- client/team_member.go | 15 +++- docs/data-sources/team_member.md | 1 + docs/resources/team_member.md | 11 ++- .../resources/vercel_team_member/resource.tf | 8 ++- vercel/data_source_team_member.go | 6 ++ vercel/resource_team_config.go | 8 +-- vercel/resource_team_member.go | 70 ++++++++++++++----- 7 files changed, 92 insertions(+), 27 deletions(-) diff --git a/client/team_member.go b/client/team_member.go index c25f490f..489d9894 100644 --- a/client/team_member.go +++ b/client/team_member.go @@ -21,7 +21,14 @@ type TeamMemberInviteRequest struct { TeamID string `json:"-"` } -func (c *Client) InviteTeamMember(ctx context.Context, request TeamMemberInviteRequest) error { +type TeamMemberInviteResponse struct { + UserID string `json:"uid"` + Email string `json:"email"` + Username string `json:"username"` + Role string `json:"role"` +} + +func (c *Client) InviteTeamMember(ctx context.Context, request TeamMemberInviteRequest) (TeamMemberInviteResponse, error) { url := fmt.Sprintf("%s/v1/teams/%s/members", c.baseURL, request.TeamID) tflog.Info(ctx, "inviting user", map[string]any{ "url": url, @@ -30,13 +37,14 @@ func (c *Client) InviteTeamMember(ctx context.Context, request TeamMemberInviteR "role": request.Role, }) + var res TeamMemberInviteResponse err := c.doRequest(clientRequest{ ctx: ctx, method: "POST", url: url, body: string(mustMarshal(request)), - }, nil) - return err + }, &res) + return res, err } type TeamMemberRemoveRequest struct { @@ -93,6 +101,7 @@ type TeamMember struct { Confirmed bool `json:"confirmed"` Role string `json:"role"` UserID string `json:"uid"` + Email string `json:"email"` Projects []ProjectRole `json:"projects"` AccessGroups []struct { ID string `json:"id"` diff --git a/docs/data-sources/team_member.md b/docs/data-sources/team_member.md index 966d24db..4d7fba29 100644 --- a/docs/data-sources/team_member.md +++ b/docs/data-sources/team_member.md @@ -30,6 +30,7 @@ data "vercel_team_member" "example" { ### Read-Only - `access_groups` (Set of String) If access groups are enabled on the team, and the user is a CONTRIBUTOR, `projects`, `access_groups` or both must be specified. A set of access groups IDs that the user should be granted access to. +- `email` (String) The email address of the existing Vercel Team Member. - `id` (String) The ID of this resource. - `projects` (Attributes Set) If access groups are enabled on the team, and the user is a CONTRIBUTOR, `projects`, `access_groups` or both must be specified. A set of projects that the user should be granted access to, along with their role in each project. (see [below for nested schema](#nestedatt--projects)) - `role` (String) The role that the user should have in the project. One of 'MEMBER', 'OWNER', 'VIEWER', 'DEVELOPER', 'BILLING' or 'CONTRIBUTOR'. Depending on your Team's plan, some of these roles may be unavailable. diff --git a/docs/resources/team_member.md b/docs/resources/team_member.md index 90d11908..5611291f 100644 --- a/docs/resources/team_member.md +++ b/docs/resources/team_member.md @@ -13,11 +13,17 @@ Provider a resource for managing a team member. ## Example Usage ```terraform -resource "vercel_team_member" "example" { +resource "vercel_team_member" "by_user_id" { team_id = "team_xxxxxxxxxxxxxxxxxxxxxxxx" user_id = "uuuuuuuuuuuuuuuuuuuuuuuuuu" role = "MEMBER" } + +resource "vercel_team_member" "by_email" { + team_id = "team_xxxxxxxxxxxxxxxxxxxxxxxx" + email = "example@example.com" + role = "MEMBER" +} ``` @@ -27,12 +33,13 @@ resource "vercel_team_member" "example" { - `role` (String) The role that the user should have in the project. One of 'MEMBER', 'OWNER', 'VIEWER', 'DEVELOPER', 'BILLING' or 'CONTRIBUTOR'. Depending on your Team's plan, some of these roles may be unavailable. - `team_id` (String) The ID of the existing Vercel Team. -- `user_id` (String) The ID of the user to add to the team. ### Optional - `access_groups` (Set of String) If access groups are enabled on the team, and the user is a CONTRIBUTOR, `projects`, `access_groups` or both must be specified. A set of access groups IDs that the user should be granted access to. +- `email` (String) The email of the user to add to the team. Must specify one of user_id or email. - `projects` (Attributes Set) If access groups are enabled on the team, and the user is a CONTRIBUTOR, `projects`, `access_groups` or both must be specified. A set of projects that the user should be granted access to, along with their role in each project. (see [below for nested schema](#nestedatt--projects)) +- `user_id` (String) The ID of the user to add to the team. Must specify one of user_id or email. ### Nested Schema for `projects` diff --git a/examples/resources/vercel_team_member/resource.tf b/examples/resources/vercel_team_member/resource.tf index aa3cf9f0..60942815 100644 --- a/examples/resources/vercel_team_member/resource.tf +++ b/examples/resources/vercel_team_member/resource.tf @@ -1,5 +1,11 @@ -resource "vercel_team_member" "example" { +resource "vercel_team_member" "by_user_id" { team_id = "team_xxxxxxxxxxxxxxxxxxxxxxxx" user_id = "uuuuuuuuuuuuuuuuuuuuuuuuuu" role = "MEMBER" } + +resource "vercel_team_member" "by_email" { + team_id = "team_xxxxxxxxxxxxxxxxxxxxxxxx" + email = "example@example.com" + role = "MEMBER" +} diff --git a/vercel/data_source_team_member.go b/vercel/data_source_team_member.go index 5cff4811..750347ba 100644 --- a/vercel/data_source_team_member.go +++ b/vercel/data_source_team_member.go @@ -64,6 +64,10 @@ func (d *teamMemberDataSource) Schema(_ context.Context, req datasource.SchemaRe Description: "The ID of the existing Vercel Team Member.", Required: true, }, + "email": schema.StringAttribute{ + Description: "The email address of the existing Vercel Team Member.", + Computed: true, + }, "role": schema.StringAttribute{ Description: "The role that the user should have in the project. One of 'MEMBER', 'OWNER', 'VIEWER', 'DEVELOPER', 'BILLING' or 'CONTRIBUTOR'. Depending on your Team's plan, some of these roles may be unavailable.", Computed: true, @@ -104,6 +108,7 @@ func (d *teamMemberDataSource) Schema(_ context.Context, req datasource.SchemaRe type TeamMemberWithID struct { UserID types.String `tfsdk:"user_id"` + Email types.String `tfsdk:"email"` TeamID types.String `tfsdk:"team_id"` Role types.String `tfsdk:"role"` Projects types.Set `tfsdk:"projects"` @@ -133,6 +138,7 @@ func (d *teamMemberDataSource) Read(ctx context.Context, req datasource.ReadRequ diags = resp.State.Set(ctx, TeamMemberWithID{ UserID: teamMember.UserID, TeamID: teamMember.TeamID, + Email: teamMember.Email, Role: teamMember.Role, Projects: teamMember.Projects, AccessGroups: teamMember.AccessGroups, diff --git a/vercel/resource_team_config.go b/vercel/resource_team_config.go index 07d79c8c..d1bb9bc0 100644 --- a/vercel/resource_team_config.go +++ b/vercel/resource_team_config.go @@ -130,10 +130,10 @@ func (r *teamConfigResource) Schema(_ context.Context, req resource.SchemaReques ElementType: types.StringType, Validators: []validator.Map{ // Validate only this attribute or roles is configured. - mapvalidator.ExactlyOneOf(path.Expressions{ + mapvalidator.ExactlyOneOf( path.MatchRoot("saml.roles"), path.MatchRoot("saml.access_group_id"), - }...), + ), }, }, "access_group_id": schema.StringAttribute{ @@ -142,10 +142,10 @@ func (r *teamConfigResource) Schema(_ context.Context, req resource.SchemaReques Validators: []validator.String{ stringvalidator.RegexMatches(regexp.MustCompile("^ag_[A-z0-9_ -]+$"), "Access group ID must be a valid access group"), // Validate only this attribute or roles is configured. - stringvalidator.ExactlyOneOf(path.Expressions{ + stringvalidator.ExactlyOneOf( path.MatchRoot("saml.roles"), path.MatchRoot("saml.access_group_id"), - }...), + ), }, }, }, diff --git a/vercel/resource_team_member.go b/vercel/resource_team_member.go index 61c45b0f..3ca3ac37 100644 --- a/vercel/resource_team_member.go +++ b/vercel/resource_team_member.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" @@ -71,11 +72,33 @@ func (r *teamMemberResource) Schema(_ context.Context, req resource.SchemaReques }, }, "user_id": schema.StringAttribute{ - Description: "The ID of the user to add to the team.", - Required: true, + Description: "The ID of the user to add to the team. Must specify one of user_id or email.", + Optional: true, + Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), - stringplanmodifier.RequiresReplace(), + stringplanmodifier.RequiresReplaceIfConfigured(), + }, + Validators: []validator.String{ + stringvalidator.ExactlyOneOf( + path.MatchRoot("user_id"), + path.MatchRoot("email"), + ), + }, + }, + "email": schema.StringAttribute{ + Description: "The email of the user to add to the team. Must specify one of user_id or email.", + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplaceIfConfigured(), + }, + Validators: []validator.String{ + stringvalidator.ExactlyOneOf( + path.MatchRoot("user_id"), + path.MatchRoot("email"), + ), }, }, "role": schema.StringAttribute{ @@ -126,6 +149,7 @@ func (r *teamMemberResource) Schema(_ context.Context, req resource.SchemaReques type TeamMember struct { UserID types.String `tfsdk:"user_id"` + Email types.String `tfsdk:"email"` TeamID types.String `tfsdk:"team_id"` Role types.String `tfsdk:"role"` Projects types.Set `tfsdk:"projects"` @@ -177,6 +201,7 @@ func (t TeamMember) toInviteTeamMemberRequest(ctx context.Context) (client.TeamM return client.TeamMemberInviteRequest{ TeamID: t.TeamID.ValueString(), UserID: t.UserID.ValueString(), + Email: t.Email.ValueString(), Role: t.Role.ValueString(), Projects: projects, AccessGroups: accessGroups, @@ -269,6 +294,7 @@ func convertResponseToTeamMember(response client.TeamMember, teamID types.String return TeamMember{ UserID: types.StringValue(response.UserID), + Email: types.StringValue(response.Email), TeamID: teamID, Role: types.StringValue(response.Role), Projects: projects, @@ -289,7 +315,7 @@ func (r *teamMemberResource) Create(ctx context.Context, req resource.CreateRequ resp.Diagnostics.Append(diags...) return } - err := r.client.InviteTeamMember(ctx, request) + res, err := r.client.InviteTeamMember(ctx, request) if err != nil { resp.Diagnostics.AddError( "Error inviting Team Member", @@ -303,21 +329,30 @@ func (r *teamMemberResource) Create(ctx context.Context, req resource.CreateRequ "user_id": plan.UserID.ValueString(), }) - projects := types.SetNull(projectsElemType) - if !plan.Projects.IsUnknown() && !plan.Projects.IsNull() { - projects = plan.Projects + response, err := r.client.GetTeamMember(ctx, client.GetTeamMemberRequest{ + TeamID: plan.TeamID.ValueString(), + UserID: res.UserID, + }) + if err != nil { + resp.Diagnostics.AddError( + "Error reading Team Member", + "Could not read Team Member, unexpected error: "+err.Error(), + ) } - ags := types.SetNull(types.StringType) - if !plan.AccessGroups.IsUnknown() && !plan.AccessGroups.IsNull() { - ags = plan.AccessGroups + teamMember := convertResponseToTeamMember(response, plan.TeamID) + if !response.Confirmed { + // The API doesn't return the projects or access groups for unconfirmed members, so we have to + // manually set these fields to whatever was in the plan. + teamMember.Projects = types.SetNull(projectsElemType) + if !plan.Projects.IsUnknown() && !plan.Projects.IsNull() { + teamMember.Projects = plan.Projects + } + teamMember.AccessGroups = types.SetNull(types.StringType) + if !plan.AccessGroups.IsUnknown() && !plan.AccessGroups.IsNull() { + teamMember.AccessGroups = plan.AccessGroups + } } - diags = resp.State.Set(ctx, TeamMember{ - TeamID: plan.TeamID, - UserID: plan.UserID, - Role: plan.Role, - Projects: projects, - AccessGroups: ags, - }) + diags = resp.State.Set(ctx, teamMember) resp.Diagnostics.Append(diags...) sleepInTests() } @@ -414,6 +449,7 @@ func (r *teamMemberResource) Update(ctx context.Context, req resource.UpdateRequ diags = resp.State.Set(ctx, TeamMember{ TeamID: plan.TeamID, UserID: plan.UserID, + Email: plan.Email, Role: plan.Role, Projects: projects, AccessGroups: ags, From 0642e2da83969dcd53e8b1ebba6a9f295fac076b Mon Sep 17 00:00:00 2001 From: Douglas Harcourt Parsons Date: Thu, 6 Mar 2025 15:09:32 +0000 Subject: [PATCH 3/5] Remove parallel from test. It's causing a race condition --- vercel/resource_team_member_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/vercel/resource_team_member_test.go b/vercel/resource_team_member_test.go index 58176b4d..f19367e0 100644 --- a/vercel/resource_team_member_test.go +++ b/vercel/resource_team_member_test.go @@ -21,7 +21,6 @@ func getTeamMemberImportID(n string) resource.ImportStateIdFunc { } func TestAcc_TeamMemberResource(t *testing.T) { - t.Parallel() randomSuffix := acctest.RandString(16) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, From 56bf6ae2fca7c9d90287d81935fe883f8e2970c4 Mon Sep 17 00:00:00 2001 From: Douglas Harcourt Parsons Date: Fri, 7 Mar 2025 12:57:01 +0000 Subject: [PATCH 4/5] Fix team_member resource race conditions --- vercel/contains.go | 2 +- vercel/data_source_team_member.go | 9 +- vercel/resource_team_member.go | 267 ++++++++++++++++++++-------- vercel/resource_team_member_test.go | 20 +-- vercel/retry.go | 39 ++++ 5 files changed, 248 insertions(+), 89 deletions(-) create mode 100644 vercel/retry.go diff --git a/vercel/contains.go b/vercel/contains.go index 3fe39aeb..7441a49e 100644 --- a/vercel/contains.go +++ b/vercel/contains.go @@ -1,6 +1,6 @@ package vercel -func contains(items []string, i string) bool { +func contains[T comparable](items []T, i T) bool { for _, j := range items { if j == i { return true diff --git a/vercel/data_source_team_member.go b/vercel/data_source_team_member.go index 750347ba..1af8e97c 100644 --- a/vercel/data_source_team_member.go +++ b/vercel/data_source_team_member.go @@ -134,7 +134,14 @@ func (d *teamMemberDataSource) Read(ctx context.Context, req datasource.ReadRequ "Could not read Team Member, unexpected error: "+err.Error(), ) } - teamMember := convertResponseToTeamMember(response, config.TeamID) + teamMember := convertResponseToTeamMember(response, TeamMember{ + UserID: config.UserID, + Email: config.Email, + TeamID: config.TeamID, + Role: config.Role, + Projects: config.Projects, + AccessGroups: config.AccessGroups, + }) diags = resp.State.Set(ctx, TeamMemberWithID{ UserID: teamMember.UserID, TeamID: teamMember.TeamID, diff --git a/vercel/resource_team_member.go b/vercel/resource_team_member.go index 3ca3ac37..bb5b22d4 100644 --- a/vercel/resource_team_member.go +++ b/vercel/resource_team_member.go @@ -59,6 +59,20 @@ func (r *teamMemberResource) Configure(ctx context.Context, req resource.Configu r.client = client } +func (r *teamMemberResource) userIsUnconfirmed(ctx context.Context, req planmodifier.SetRequest, resp *setplanmodifier.RequiresReplaceIfFuncResponse) { + if req.PlanValue.IsNull() || req.PlanValue.IsUnknown() { + return + } + var state TeamMember + diags := req.Plan.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + resp.RequiresReplace = !state.Confirmed.ValueBool() +} + func (r *teamMemberResource) Schema(_ context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ Description: "Provider a resource for managing a team member.", @@ -111,9 +125,8 @@ func (r *teamMemberResource) Schema(_ context.Context, req resource.SchemaReques "projects": schema.SetNestedAttribute{ Description: "If access groups are enabled on the team, and the user is a CONTRIBUTOR, `projects`, `access_groups` or both must be specified. A set of projects that the user should be granted access to, along with their role in each project.", Optional: true, - Computed: true, PlanModifiers: []planmodifier.Set{ - setplanmodifier.UseStateForUnknown(), + setplanmodifier.RequiresReplaceIf(r.userIsUnconfirmed, "Can only update projects on confirmed team members", "Can only update projects on confirmed team members"), }, NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ @@ -134,14 +147,14 @@ func (r *teamMemberResource) Schema(_ context.Context, req resource.SchemaReques "access_groups": schema.SetAttribute{ Description: "If access groups are enabled on the team, and the user is a CONTRIBUTOR, `projects`, `access_groups` or both must be specified. A set of access groups IDs that the user should be granted access to.", Optional: true, - Computed: true, ElementType: types.StringType, Validators: []validator.Set{ setvalidator.SizeAtLeast(1), }, - PlanModifiers: []planmodifier.Set{ - setplanmodifier.UseStateForUnknown(), - }, + }, + "confirmed": schema.BoolAttribute{ + Description: "Whether the user has confirmed their invitation.", + Computed: true, }, }, } @@ -154,6 +167,7 @@ type TeamMember struct { Role types.String `tfsdk:"role"` Projects types.Set `tfsdk:"projects"` AccessGroups types.Set `tfsdk:"access_groups"` + Confirmed types.Bool `tfsdk:"confirmed"` } func (t TeamMember) projects(ctx context.Context) ([]TeamMemberProject, diag.Diagnostics) { @@ -208,6 +222,23 @@ func (t TeamMember) toInviteTeamMemberRequest(ctx context.Context) (client.TeamM }, diags } +func areSameProjects(oldProjects, newProjects []TeamMemberProject) bool { + if len(oldProjects) != len(newProjects) { + return false + } + for _, p := range oldProjects { + if !contains(newProjects, p) { + return false + } + } + for _, p := range newProjects { + if !contains(oldProjects, p) { + return false + } + } + return true +} + func diffAccessGroups(oldAgs, newAgs []string) (toAdd, toRemove []string) { for _, n := range newAgs { if !contains(oldAgs, n) { @@ -270,7 +301,7 @@ var projectsElemType = types.ObjectType{ }, } -func convertResponseToTeamMember(response client.TeamMember, teamID types.String) TeamMember { +func convertResponseToTeamMember(response client.TeamMember, plan TeamMember) TeamMember { var projectsAttrs []attr.Value for _, p := range response.Projects { projectsAttrs = append(projectsAttrs, types.ObjectValueMust( @@ -292,14 +323,29 @@ func convertResponseToTeamMember(response client.TeamMember, teamID types.String } accessGroups := types.SetValueMust(types.StringType, ags) - return TeamMember{ + teamMember := TeamMember{ UserID: types.StringValue(response.UserID), Email: types.StringValue(response.Email), - TeamID: teamID, + TeamID: plan.TeamID, Role: types.StringValue(response.Role), Projects: projects, AccessGroups: accessGroups, + Confirmed: types.BoolValue(response.Confirmed), + } + + if !response.Confirmed { + // The API doesn't return the projects or access groups for unconfirmed members, so we have to + // manually set these fields to whatever was in the plan. + teamMember.Projects = types.SetNull(projectsElemType) + if !plan.Projects.IsUnknown() && !plan.Projects.IsNull() { + teamMember.Projects = plan.Projects + } + teamMember.AccessGroups = types.SetNull(types.StringType) + if !plan.AccessGroups.IsUnknown() && !plan.AccessGroups.IsNull() { + teamMember.AccessGroups = plan.AccessGroups + } } + return teamMember } func (r *teamMemberResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { @@ -324,45 +370,66 @@ func (r *teamMemberResource) Create(ctx context.Context, req resource.CreateRequ return } - tflog.Info(ctx, "invited Team Member", map[string]any{ + tflog.Error(ctx, "Invited Team Member", map[string]any{ "team_id": plan.TeamID.ValueString(), "user_id": plan.UserID.ValueString(), }) - response, err := r.client.GetTeamMember(ctx, client.GetTeamMemberRequest{ - TeamID: plan.TeamID.ValueString(), - UserID: res.UserID, + planAGs, diags := plan.accessGroups(ctx) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + planProjects, diags := plan.projects(ctx) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + var response client.TeamMember + getRetry := Retry{ + Base: 200 * time.Millisecond, + Attempts: 7, + } + err = getRetry.Do(func(attempt int) (shouldRetry bool, err error) { + response, err = r.client.GetTeamMember(ctx, client.GetTeamMemberRequest{ + TeamID: plan.TeamID.ValueString(), + UserID: res.UserID, + }) + if client.NotFound(err) { + return true, err + } + teamMember := convertResponseToTeamMember(response, plan) + if teamMember.Role != plan.Role { + tflog.Error(ctx, "Role has not yet propagated", map[string]any{}) + return true, fmt.Errorf("role has not yet propagated") + } + respAGs, _ := teamMember.accessGroups(ctx) + if new, old := diffAccessGroups(respAGs, planAGs); len(new) > 0 || len(old) > 0 { + tflog.Error(ctx, "AGs have not yet propagated", map[string]any{}) + return true, fmt.Errorf("access groups have not yet propagated") + } + respProjects, _ := teamMember.projects(ctx) + if !areSameProjects(respProjects, planProjects) { + tflog.Error(ctx, "Projects have not yet propagated", map[string]any{}) + return true, fmt.Errorf("projects have not yet propagated") + } + return false, err + }) + tflog.Error(ctx, "Read team member after inviting", map[string]any{ + "team_id": plan.TeamID.ValueString(), + "user_id": plan.UserID.ValueString(), + "err": err, }) if err != nil { resp.Diagnostics.AddError( "Error reading Team Member", "Could not read Team Member, unexpected error: "+err.Error(), ) + return } - teamMember := convertResponseToTeamMember(response, plan.TeamID) - if !response.Confirmed { - // The API doesn't return the projects or access groups for unconfirmed members, so we have to - // manually set these fields to whatever was in the plan. - teamMember.Projects = types.SetNull(projectsElemType) - if !plan.Projects.IsUnknown() && !plan.Projects.IsNull() { - teamMember.Projects = plan.Projects - } - teamMember.AccessGroups = types.SetNull(types.StringType) - if !plan.AccessGroups.IsUnknown() && !plan.AccessGroups.IsNull() { - teamMember.AccessGroups = plan.AccessGroups - } - } + teamMember := convertResponseToTeamMember(response, plan) diags = resp.State.Set(ctx, teamMember) resp.Diagnostics.Append(diags...) - sleepInTests() -} - -func sleepInTests() { - if os.Getenv("TF_ACC") == "true" { - // Give a couple of seconds for the user to propagate. - // This is horrible, but works for now. - time.Sleep(5 * time.Second) - } } func (r *teamMemberResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { @@ -372,11 +439,20 @@ func (r *teamMemberResource) Read(ctx context.Context, req resource.ReadRequest, if resp.Diagnostics.HasError() { return } + // sleep to allow time for the user to propagate in the Vercel system. + if os.Getenv("TF_ACC") == "true" { + time.Sleep(5 * time.Second) + } response, err := r.client.GetTeamMember(ctx, client.GetTeamMemberRequest{ TeamID: state.TeamID.ValueString(), UserID: state.UserID.ValueString(), }) + tflog.Error(ctx, "Read team member", map[string]any{ + "team_id": state.TeamID.ValueString(), + "user_id": state.UserID.ValueString(), + "err": err, + }) if client.NotFound(err) { resp.State.RemoveResource(ctx) return @@ -387,19 +463,7 @@ func (r *teamMemberResource) Read(ctx context.Context, req resource.ReadRequest, "Could not read Team Member, unexpected error: "+err.Error(), ) } - teamMember := convertResponseToTeamMember(response, state.TeamID) - if !response.Confirmed { - // The API doesn't return the projects or access groups for unconfirmed members, so we have to - // manually set these fields to whatever was in state. - teamMember.Projects = types.SetNull(projectsElemType) - if !state.Projects.IsUnknown() && !state.Projects.IsNull() { - teamMember.Projects = state.Projects - } - teamMember.AccessGroups = types.SetNull(types.StringType) - if !state.AccessGroups.IsUnknown() && !state.AccessGroups.IsNull() { - teamMember.AccessGroups = state.AccessGroups - } - } + teamMember := convertResponseToTeamMember(response, state) diags = resp.State.Set(ctx, teamMember) resp.Diagnostics.Append(diags...) } @@ -419,6 +483,10 @@ func (r *teamMemberResource) Update(ctx context.Context, req resource.UpdateRequ return } + tflog.Error(ctx, "updating team member", map[string]any{ + "state": state, + "plan": plan, + }) request, diags := plan.toTeamMemberUpdateRequest(ctx, state) if diags.HasError() { resp.Diagnostics.Append(diags...) @@ -432,30 +500,63 @@ func (r *teamMemberResource) Update(ctx context.Context, req resource.UpdateRequ ) return } - + var teamMember TeamMember + planAGs, diags := plan.accessGroups(ctx) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + planProjects, diags := plan.projects(ctx) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + getRetry := Retry{ + Base: 200 * time.Millisecond, + Attempts: 7, + } + err = getRetry.Do(func(attempt int) (shouldRetry bool, err error) { + response, err := r.client.GetTeamMember(ctx, client.GetTeamMemberRequest{ + TeamID: plan.TeamID.ValueString(), + UserID: plan.UserID.ValueString(), + }) + if client.NotFound(err) { + return true, err + } + tflog.Error(ctx, "Fetched team member", map[string]any{ + "team_id": plan.TeamID.ValueString(), + "user_id": plan.UserID.ValueString(), + "role": response.Role, + }) + teamMember = convertResponseToTeamMember(response, plan) + if teamMember.Role != plan.Role { + tflog.Error(ctx, "Role has not yet propagated", map[string]any{}) + return true, fmt.Errorf("role has not yet propagated") + } + respAGs, _ := teamMember.accessGroups(ctx) + if new, old := diffAccessGroups(respAGs, planAGs); len(new) > 0 || len(old) > 0 { + tflog.Error(ctx, "AGs have not yet propagated", map[string]any{}) + return true, fmt.Errorf("access groups have not yet propagated") + } + respProjects, _ := teamMember.projects(ctx) + if !areSameProjects(respProjects, planProjects) { + tflog.Error(ctx, "Projects have not yet propagated", map[string]any{}) + return true, fmt.Errorf("projects have not yet propagated") + } + return false, err + }) + if err != nil { + resp.Diagnostics.AddError( + "Error reading Team Member", + "Could not read Team Member, unexpected error: "+err.Error(), + ) + } tflog.Info(ctx, "updated Team member", map[string]any{ "team_id": request.TeamID, "user_id": request.UserID, }) - - projects := types.SetNull(projectsElemType) - if !plan.Projects.IsUnknown() && !plan.Projects.IsNull() { - projects = plan.Projects - } - ags := types.SetNull(types.StringType) - if !plan.AccessGroups.IsUnknown() && !plan.AccessGroups.IsNull() { - ags = plan.AccessGroups - } - diags = resp.State.Set(ctx, TeamMember{ - TeamID: plan.TeamID, - UserID: plan.UserID, - Email: plan.Email, - Role: plan.Role, - Projects: projects, - AccessGroups: ags, - }) + diags = resp.State.Set(ctx, teamMember) resp.Diagnostics.Append(diags...) - sleepInTests() } func (r *teamMemberResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { @@ -466,6 +567,11 @@ func (r *teamMemberResource) Delete(ctx context.Context, req resource.DeleteRequ return } + tflog.Info(ctx, "Removing team member", map[string]any{ + "team_id": state.TeamID, + "user_id": state.UserID, + }) + err := r.client.RemoveTeamMember(ctx, state.toTeamMemberRemoveRequest()) if client.NotFound(err) { resp.State.RemoveResource(ctx) @@ -479,7 +585,6 @@ func (r *teamMemberResource) Delete(ctx context.Context, req resource.DeleteRequ } resp.State.RemoveResource(ctx) - sleepInTests() } // ImportState implements resource.ResourceWithImportState. @@ -492,14 +597,20 @@ func (r *teamMemberResource) ImportState(ctx context.Context, req resource.Impor ) } - tflog.Info(ctx, "import Team Member", map[string]any{ - "team_id": teamID, - "user_id": userID, - }) - - response, err := r.client.GetTeamMember(ctx, client.GetTeamMemberRequest{ - TeamID: teamID, - UserID: userID, + var response client.TeamMember + getRetry := Retry{ + Base: 200 * time.Millisecond, + Attempts: 5, + } + err := getRetry.Do(func(attempt int) (shouldRetry bool, err error) { + response, err = r.client.GetTeamMember(ctx, client.GetTeamMemberRequest{ + TeamID: teamID, + UserID: userID, + }) + if client.NotFound(err) { + return true, err + } + return false, err }) if err != nil { resp.Diagnostics.AddError( @@ -507,7 +618,9 @@ func (r *teamMemberResource) ImportState(ctx context.Context, req resource.Impor "Could not read Team Member, unexpected error: "+err.Error(), ) } - teamMember := convertResponseToTeamMember(response, types.StringValue(teamID)) + teamMember := convertResponseToTeamMember(response, TeamMember{ + TeamID: types.StringValue(teamID), + }) diags := resp.State.Set(ctx, teamMember) resp.Diagnostics.Append(diags...) } diff --git a/vercel/resource_team_member_test.go b/vercel/resource_team_member_test.go index f19367e0..f669d96e 100644 --- a/vercel/resource_team_member_test.go +++ b/vercel/resource_team_member_test.go @@ -56,20 +56,20 @@ func TestAcc_TeamMemberResource(t *testing.T) { { Config: testAccTeamMemberResourceConfigWithProjects(randomSuffix), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttrSet("vercel_team_member.test_with_projects", "team_id"), - resource.TestCheckResourceAttrSet("vercel_team_member.test_with_projects", "user_id"), - resource.TestCheckResourceAttr("vercel_team_member.test_with_projects", "role", "CONTRIBUTOR"), - resource.TestCheckResourceAttr("vercel_team_member.test_with_projects", "projects.#", "1"), + resource.TestCheckResourceAttrSet("vercel_team_member.test", "team_id"), + resource.TestCheckResourceAttrSet("vercel_team_member.test", "user_id"), + resource.TestCheckResourceAttr("vercel_team_member.test", "role", "CONTRIBUTOR"), + resource.TestCheckResourceAttr("vercel_team_member.test", "projects.#", "1"), ), }, // Test with access groups { Config: testAccTeamMemberResourceConfigWithAccessGroups(randomSuffix), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttrSet("vercel_team_member.test_with_access_groups", "team_id"), - resource.TestCheckResourceAttrSet("vercel_team_member.test_with_access_groups", "user_id"), - resource.TestCheckResourceAttr("vercel_team_member.test_with_access_groups", "role", "CONTRIBUTOR"), - resource.TestCheckResourceAttr("vercel_team_member.test_with_access_groups", "access_groups.#", "1"), + resource.TestCheckResourceAttrSet("vercel_team_member.test", "team_id"), + resource.TestCheckResourceAttrSet("vercel_team_member.test", "user_id"), + resource.TestCheckResourceAttr("vercel_team_member.test", "role", "CONTRIBUTOR"), + resource.TestCheckResourceAttr("vercel_team_member.test", "access_groups.#", "1"), ), }, }, @@ -93,7 +93,7 @@ resource "vercel_project" "test" { %[2]s } -resource "vercel_team_member" "test_with_projects" { +resource "vercel_team_member" "test" { %[2]s user_id = "%s" role = "CONTRIBUTOR" @@ -112,7 +112,7 @@ resource "vercel_access_group" "test" { name = "test-acc-access-group-%[3]s" } -resource "vercel_team_member" "test_with_access_groups" { +resource "vercel_team_member" "test" { %[1]s user_id = "%[2]s" role = "CONTRIBUTOR" diff --git a/vercel/retry.go b/vercel/retry.go new file mode 100644 index 00000000..61e7bf3c --- /dev/null +++ b/vercel/retry.go @@ -0,0 +1,39 @@ +package vercel + +import ( + "math" + "time" +) + +type Retry struct { + Base time.Duration + Max time.Duration + Attempts int +} + +type RetryFunc func(attempt int) (shouldRetry bool, err error) + +func (r *Retry) Do(fn RetryFunc) error { + for attempt := 1; attempt <= r.Attempts; attempt++ { + shouldRetry, err := fn(attempt) + + if err == nil { + return nil + } else if !shouldRetry || attempt == r.Attempts { + return err + } + + sleepDuration := r.getSleepDuration(attempt) + time.Sleep(sleepDuration) + } + + return nil +} + +func (r *Retry) getSleepDuration(attempt int) time.Duration { + // exponential backoff + backoff := float64(r.Base) * math.Pow(2, float64(attempt-1)) + sleep := time.Duration(backoff) + + return sleep +} From c9eef309ad5793e2e03650acc65d4220636c2390 Mon Sep 17 00:00:00 2001 From: Douglas Harcourt Parsons Date: Fri, 7 Mar 2025 12:57:35 +0000 Subject: [PATCH 5/5] Regen docs --- docs/resources/team_member.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/resources/team_member.md b/docs/resources/team_member.md index 5611291f..d5ffaa01 100644 --- a/docs/resources/team_member.md +++ b/docs/resources/team_member.md @@ -41,6 +41,10 @@ resource "vercel_team_member" "by_email" { - `projects` (Attributes Set) If access groups are enabled on the team, and the user is a CONTRIBUTOR, `projects`, `access_groups` or both must be specified. A set of projects that the user should be granted access to, along with their role in each project. (see [below for nested schema](#nestedatt--projects)) - `user_id` (String) The ID of the user to add to the team. Must specify one of user_id or email. +### Read-Only + +- `confirmed` (Boolean) Whether the user has confirmed their invitation. + ### Nested Schema for `projects`