From e838903587a6d774adbee2b31e637f4987b238a3 Mon Sep 17 00:00:00 2001 From: Douglas Parsons Date: Tue, 24 Oct 2023 15:51:41 +0100 Subject: [PATCH 1/2] Revert "team_id should not be computed (#137)" This reverts commit 42e9671030374b8369e0c5b5487e2997cf8bb837. --- vercel/data_source_alias.go | 1 + vercel/data_source_project.go | 1 + vercel/resource_alias.go | 1 + vercel/resource_deployment.go | 1 + vercel/resource_dns_record.go | 1 + vercel/resource_project.go | 1 + vercel/resource_project_domain.go | 1 + vercel/resource_project_environment_variable.go | 1 + vercel/resource_shared_environment_variable.go | 1 + 9 files changed, 9 insertions(+) diff --git a/vercel/data_source_alias.go b/vercel/data_source_alias.go index 7e443829..14fe8704 100644 --- a/vercel/data_source_alias.go +++ b/vercel/data_source_alias.go @@ -55,6 +55,7 @@ An Alias allows a ` + "`vercel_deployment` to be accessed through a different UR Attributes: map[string]schema.Attribute{ "team_id": schema.StringAttribute{ Optional: true, + Computed: true, Description: "The ID of the team the Alias and Deployment exist under. Required when configuring a team resource if a default team has not been set in the provider.", }, "alias": schema.StringAttribute{ diff --git a/vercel/data_source_project.go b/vercel/data_source_project.go index a114aa41..2c6bb7b4 100644 --- a/vercel/data_source_project.go +++ b/vercel/data_source_project.go @@ -61,6 +61,7 @@ For more detailed information, please see the [Vercel documentation](https://ver Attributes: map[string]schema.Attribute{ "team_id": schema.StringAttribute{ Optional: true, + Computed: true, Description: "The team ID the project exists beneath. Required when configuring a team resource if a default team has not been set in the provider.", }, "name": schema.StringAttribute{ diff --git a/vercel/resource_alias.go b/vercel/resource_alias.go index 07da776e..533e92d5 100644 --- a/vercel/resource_alias.go +++ b/vercel/resource_alias.go @@ -68,6 +68,7 @@ An Alias allows a ` + "`vercel_deployment` to be accessed through a different UR }, "team_id": schema.StringAttribute{ Optional: true, + Computed: true, Description: "The ID of the team the Alias and Deployment exist under. Required when configuring a team resource if a default team has not been set in the provider.", PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()}, }, diff --git a/vercel/resource_deployment.go b/vercel/resource_deployment.go index c7fe4678..d99f11fa 100644 --- a/vercel/resource_deployment.go +++ b/vercel/resource_deployment.go @@ -92,6 +92,7 @@ terraform to your Deployment. "team_id": schema.StringAttribute{ Description: "The team ID to add the deployment to. Required when configuring a team resource if a default team has not been set in the provider.", Optional: true, + Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()}, }, "project_id": schema.StringAttribute{ diff --git a/vercel/resource_dns_record.go b/vercel/resource_dns_record.go index 81f8cdaf..3e0b364d 100644 --- a/vercel/resource_dns_record.go +++ b/vercel/resource_dns_record.go @@ -66,6 +66,7 @@ For more detailed information, please see the [Vercel documentation](https://ver }, "team_id": schema.StringAttribute{ Optional: true, + Computed: true, Description: "The team ID that the domain and DNS records belong to. Required when configuring a team resource if a default team has not been set in the provider.", PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()}, }, diff --git a/vercel/resource_project.go b/vercel/resource_project.go index ce7f1e37..5b135916 100644 --- a/vercel/resource_project.go +++ b/vercel/resource_project.go @@ -69,6 +69,7 @@ At this time you cannot use a Vercel Project resource with in-line ` + "`environ Attributes: map[string]schema.Attribute{ "team_id": schema.StringAttribute{ Optional: true, + Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()}, Description: "The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.", }, diff --git a/vercel/resource_project_domain.go b/vercel/resource_project_domain.go index e6a6fa56..28abb258 100644 --- a/vercel/resource_project_domain.go +++ b/vercel/resource_project_domain.go @@ -66,6 +66,7 @@ By default, Project Domains will be automatically applied to any ` + "`productio }, "team_id": schema.StringAttribute{ Optional: true, + Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()}, Description: "The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.", }, diff --git a/vercel/resource_project_environment_variable.go b/vercel/resource_project_environment_variable.go index 8fbb7acf..f9f49ca0 100644 --- a/vercel/resource_project_environment_variable.go +++ b/vercel/resource_project_environment_variable.go @@ -94,6 +94,7 @@ At this time you cannot use a Vercel Project resource with in-line ` + "`environ }, "team_id": schema.StringAttribute{ Optional: true, + Computed: true, Description: "The ID of the Vercel team.Required when configuring a team resource if a default team has not been set in the provider.", PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()}, }, diff --git a/vercel/resource_shared_environment_variable.go b/vercel/resource_shared_environment_variable.go index 9dbbfc21..95bde157 100644 --- a/vercel/resource_shared_environment_variable.go +++ b/vercel/resource_shared_environment_variable.go @@ -87,6 +87,7 @@ For more detailed information, please see the [Vercel documentation](https://ver }, "team_id": schema.StringAttribute{ Optional: true, + Computed: true, Description: "The ID of the Vercel team. Shared environment variables require a team.", PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()}, }, From 4a8d9ec5e3cd00a329d3191632764f095e76be3b Mon Sep 17 00:00:00 2001 From: Douglas Parsons Date: Tue, 24 Oct 2023 15:56:50 +0100 Subject: [PATCH 2/2] Fix TeamID by using RequiresReplaceIfConfigured --- vercel/resource_alias.go | 2 +- vercel/resource_deployment.go | 2 +- vercel/resource_dns_record.go | 2 +- vercel/resource_project.go | 2 +- vercel/resource_project_domain.go | 2 +- vercel/resource_project_environment_variable.go | 2 +- vercel/resource_shared_environment_variable.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vercel/resource_alias.go b/vercel/resource_alias.go index 533e92d5..76594fee 100644 --- a/vercel/resource_alias.go +++ b/vercel/resource_alias.go @@ -70,7 +70,7 @@ An Alias allows a ` + "`vercel_deployment` to be accessed through a different UR Optional: true, Computed: true, Description: "The ID of the team the Alias and Deployment exist under. Required when configuring a team resource if a default team has not been set in the provider.", - PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()}, + PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplaceIfConfigured()}, }, "id": schema.StringAttribute{ Computed: true, diff --git a/vercel/resource_deployment.go b/vercel/resource_deployment.go index d99f11fa..84697b99 100644 --- a/vercel/resource_deployment.go +++ b/vercel/resource_deployment.go @@ -93,7 +93,7 @@ terraform to your Deployment. Description: "The team ID to add the deployment to. Required when configuring a team resource if a default team has not been set in the provider.", Optional: true, Computed: true, - PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()}, + PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplaceIfConfigured(), stringplanmodifier.UseStateForUnknown()}, }, "project_id": schema.StringAttribute{ Description: "The project ID to add the deployment to.", diff --git a/vercel/resource_dns_record.go b/vercel/resource_dns_record.go index 3e0b364d..f7c351d7 100644 --- a/vercel/resource_dns_record.go +++ b/vercel/resource_dns_record.go @@ -68,7 +68,7 @@ For more detailed information, please see the [Vercel documentation](https://ver Optional: true, Computed: true, Description: "The team ID that the domain and DNS records belong to. Required when configuring a team resource if a default team has not been set in the provider.", - PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()}, + PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplaceIfConfigured(), stringplanmodifier.UseStateForUnknown()}, }, "domain": schema.StringAttribute{ Description: "The domain name, or zone, that the DNS record should be created beneath.", diff --git a/vercel/resource_project.go b/vercel/resource_project.go index 5b135916..d111eceb 100644 --- a/vercel/resource_project.go +++ b/vercel/resource_project.go @@ -70,7 +70,7 @@ At this time you cannot use a Vercel Project resource with in-line ` + "`environ "team_id": schema.StringAttribute{ Optional: true, Computed: true, - PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()}, + PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplaceIfConfigured(), stringplanmodifier.UseStateForUnknown()}, Description: "The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.", }, "name": schema.StringAttribute{ diff --git a/vercel/resource_project_domain.go b/vercel/resource_project_domain.go index 28abb258..f91962b5 100644 --- a/vercel/resource_project_domain.go +++ b/vercel/resource_project_domain.go @@ -67,7 +67,7 @@ By default, Project Domains will be automatically applied to any ` + "`productio "team_id": schema.StringAttribute{ Optional: true, Computed: true, - PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()}, + PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplaceIfConfigured(), stringplanmodifier.UseStateForUnknown()}, Description: "The ID of the team the project exists under. Required when configuring a team resource if a default team has not been set in the provider.", }, "id": schema.StringAttribute{ diff --git a/vercel/resource_project_environment_variable.go b/vercel/resource_project_environment_variable.go index f9f49ca0..604c07c1 100644 --- a/vercel/resource_project_environment_variable.go +++ b/vercel/resource_project_environment_variable.go @@ -96,7 +96,7 @@ At this time you cannot use a Vercel Project resource with in-line ` + "`environ Optional: true, Computed: true, Description: "The ID of the Vercel team.Required when configuring a team resource if a default team has not been set in the provider.", - PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()}, + PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplaceIfConfigured(), stringplanmodifier.UseStateForUnknown()}, }, "id": schema.StringAttribute{ Description: "The ID of the Environment Variable.", diff --git a/vercel/resource_shared_environment_variable.go b/vercel/resource_shared_environment_variable.go index 95bde157..5ea50417 100644 --- a/vercel/resource_shared_environment_variable.go +++ b/vercel/resource_shared_environment_variable.go @@ -89,7 +89,7 @@ For more detailed information, please see the [Vercel documentation](https://ver Optional: true, Computed: true, Description: "The ID of the Vercel team. Shared environment variables require a team.", - PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()}, + PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplaceIfConfigured(), stringplanmodifier.UseStateForUnknown()}, }, "id": schema.StringAttribute{ Description: "The ID of the Environment Variable.",