From 1c7add628bc0ce473aed370d88cd731a3fe2ab94 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 4 Jul 2024 01:00:42 +0300 Subject: [PATCH 1/5] wip --- docs/index.md | 6 ++++++ templates/index.md.tmpl | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/docs/index.md b/docs/index.md index a4dfd70e..9601bb8b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,6 +8,12 @@ description: |- # Coder Provider +The Coder provider is used to help create [Coder](https://coder.com) templates. Coder is a self-hosted cloud development environment that allows enterprises to create consistent, secure, and scalable development environments for their teams. + +-> Requires Coder v2.13.0 or later. + +!> `coder_git_auth` and owner related fields of `coder_workspace` data source have been removed. Follow the [v0 to v1migration guide](https://registry.terraform.io/providers/codercom/coder/latest/docs/guides/v0-to-v1-migration) to update your code. + ## Example ```terraform diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl index 5ca983fd..514a715e 100644 --- a/templates/index.md.tmpl +++ b/templates/index.md.tmpl @@ -8,6 +8,12 @@ description: |- # Coder Provider +The Coder provider is used to help create [Coder](https://coder.com) templates. Coder is a self-hosted cloud development environment that allows enterprises to create consistent, secure, and scalable development environments for their teams. + +-> Requires Coder v2.13.0 or later. + +!> `coder_git_auth` and owner related fields of `coder_workspace` data source have been removed. Follow the [v0 to v1migration guide](https://registry.terraform.io/providers/codercom/coder/latest/docs/guides/v0-to-v1-migration) to update your code. + ## Example {{tffile "examples/provider/provider.tf"}} From 7451a9221ad7b656fe4467ae7e64ae31b12c7948 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 4 Jul 2024 18:20:58 +0300 Subject: [PATCH 2/5] docs: add migration guide for v1 to v2 --- docs/guides/v1-to-v2-migration.md | 47 +++++++++++++++++++++++++++++++ templates/index.md.tmpl | 3 +- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 docs/guides/v1-to-v2-migration.md diff --git a/docs/guides/v1-to-v2-migration.md b/docs/guides/v1-to-v2-migration.md new file mode 100644 index 00000000..fcde0b99 --- /dev/null +++ b/docs/guides/v1-to-v2-migration.md @@ -0,0 +1,47 @@ +--- +page_title: "Migrate from v1 to v2" +--- + +# Migrate from v1 to v2 + +Version 2.0.0 of the Coder provider for Terraform is a major release that removes the following deprecated data sources and their properties: + +- `coder_git_auth` data source +- All owner properties from the [`coder_workspace`](../docs/data-sources/workspace.md) data source + +## Migrating `coder_git_auth` data source + +If you are using this data source, you must replace it with the [`coder_external_auth`](../docs/data-sources/external-auth.md) data source. The `coder_external_auth` data source is a more generic data source that can be used to create any external authentication provider. + +### v1.0.0 +```terraform + +data "coder_git_auth" "example" { + id = "example" +} +``` +### v2.0.0 +```terraform +data "coder_external_auth" "example" { + id = "example" +} +``` + + +## Migrating `coder_workspace` data source + +If you are using the `owner` properties of the `coder_workspace` data source, you must remove them and use the `coder_workspace_owner` data source instead. The `coder_workspace_owner` data source is a more generic data source that provide additional properties of the workspace owner. + +| `v1.0.0` | `v2.0.0` | +|-----------|----------| +| `data.coder_workspace.me.owner_id` | `data.coder_workspace_owner.me.id` | +| `data.coder_workspace.me.owner` | `data.coder_workspace_owner.me.name` | +| `data.coder_workspace.me.owner_name` | `data.coder_workspace_owner.me.full_name` | +| `data.coder_workspace.me.owner_email` | `data.coder_workspace_owner.me.email` | +| `data.coder_workspace.me.owner_groups` | `data.coder_workspace_owner.me.groups` | +| `data.coder_workspace.me.owner_oidc_access_token` | `data.coder_workspace_owner.me.oidc_access_token` | +| `data.coder_workspace.me.owner_session_token` | `data.coder_workspace_owner.me.session_token` | + +```terraform + +->While we do not anticipate these changes to affect existing resources, we strongly advice reviewing the plan produced by Terraform to ensure no resources are accidentally removed or altered in an undesired way. If you encounter any unexpected behavior, please report it by opening a GitHub [issue](https://github.com/coder/terraform-provider-coder/issues). diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl index 514a715e..4f8a89d6 100644 --- a/templates/index.md.tmpl +++ b/templates/index.md.tmpl @@ -3,6 +3,7 @@ page_title: "Coder Provider" subcategory: "Infrastructure" description: |- + Terraform provider for Coder. Coder is a self-hosted cloud development environment that allows enterprises to create consistent, secure, and scalable development environments for their teams. --- @@ -12,7 +13,7 @@ The Coder provider is used to help create [Coder](https://coder.com) templates. -> Requires Coder v2.13.0 or later. -!> `coder_git_auth` and owner related fields of `coder_workspace` data source have been removed. Follow the [v0 to v1migration guide](https://registry.terraform.io/providers/codercom/coder/latest/docs/guides/v0-to-v1-migration) to update your code. +!> `coder_git_auth` and owner related fields of `coder_workspace` data source have been removed. Follow the [v0 to v1migration guide](https://registry.terraform.io/providers/codercom/coder/latest/docs/guides/v1-to-v2-migration) to update your code. ## Example From c0fb526144ba83c6e3d883438a3010a7b27e2f3d Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 4 Jul 2024 18:38:37 +0300 Subject: [PATCH 3/5] move to templates --- docs/guides/v1-to-v2-migration.md | 2 - docs/index.md | 3 +- templates/guides/v1-to-v2-migration.md.tmpl | 45 +++++++++++++++++++++ 3 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 templates/guides/v1-to-v2-migration.md.tmpl diff --git a/docs/guides/v1-to-v2-migration.md b/docs/guides/v1-to-v2-migration.md index fcde0b99..fd39dc90 100644 --- a/docs/guides/v1-to-v2-migration.md +++ b/docs/guides/v1-to-v2-migration.md @@ -42,6 +42,4 @@ If you are using the `owner` properties of the `coder_workspace` data source, yo | `data.coder_workspace.me.owner_oidc_access_token` | `data.coder_workspace_owner.me.oidc_access_token` | | `data.coder_workspace.me.owner_session_token` | `data.coder_workspace_owner.me.session_token` | -```terraform - ->While we do not anticipate these changes to affect existing resources, we strongly advice reviewing the plan produced by Terraform to ensure no resources are accidentally removed or altered in an undesired way. If you encounter any unexpected behavior, please report it by opening a GitHub [issue](https://github.com/coder/terraform-provider-coder/issues). diff --git a/docs/index.md b/docs/index.md index 9601bb8b..b3308dd9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,6 +3,7 @@ page_title: "Coder Provider" subcategory: "Infrastructure" description: |- + Terraform provider for Coder. Coder is a self-hosted cloud development environment that allows enterprises to create consistent, secure, and scalable development environments for their teams. --- @@ -12,7 +13,7 @@ The Coder provider is used to help create [Coder](https://coder.com) templates. -> Requires Coder v2.13.0 or later. -!> `coder_git_auth` and owner related fields of `coder_workspace` data source have been removed. Follow the [v0 to v1migration guide](https://registry.terraform.io/providers/codercom/coder/latest/docs/guides/v0-to-v1-migration) to update your code. +!> `coder_git_auth` and owner related fields of `coder_workspace` data source have been removed. Follow the [v0 to v1migration guide](https://registry.terraform.io/providers/codercom/coder/latest/docs/guides/v1-to-v2-migration) to update your code. ## Example diff --git a/templates/guides/v1-to-v2-migration.md.tmpl b/templates/guides/v1-to-v2-migration.md.tmpl new file mode 100644 index 00000000..fd39dc90 --- /dev/null +++ b/templates/guides/v1-to-v2-migration.md.tmpl @@ -0,0 +1,45 @@ +--- +page_title: "Migrate from v1 to v2" +--- + +# Migrate from v1 to v2 + +Version 2.0.0 of the Coder provider for Terraform is a major release that removes the following deprecated data sources and their properties: + +- `coder_git_auth` data source +- All owner properties from the [`coder_workspace`](../docs/data-sources/workspace.md) data source + +## Migrating `coder_git_auth` data source + +If you are using this data source, you must replace it with the [`coder_external_auth`](../docs/data-sources/external-auth.md) data source. The `coder_external_auth` data source is a more generic data source that can be used to create any external authentication provider. + +### v1.0.0 +```terraform + +data "coder_git_auth" "example" { + id = "example" +} +``` +### v2.0.0 +```terraform +data "coder_external_auth" "example" { + id = "example" +} +``` + + +## Migrating `coder_workspace` data source + +If you are using the `owner` properties of the `coder_workspace` data source, you must remove them and use the `coder_workspace_owner` data source instead. The `coder_workspace_owner` data source is a more generic data source that provide additional properties of the workspace owner. + +| `v1.0.0` | `v2.0.0` | +|-----------|----------| +| `data.coder_workspace.me.owner_id` | `data.coder_workspace_owner.me.id` | +| `data.coder_workspace.me.owner` | `data.coder_workspace_owner.me.name` | +| `data.coder_workspace.me.owner_name` | `data.coder_workspace_owner.me.full_name` | +| `data.coder_workspace.me.owner_email` | `data.coder_workspace_owner.me.email` | +| `data.coder_workspace.me.owner_groups` | `data.coder_workspace_owner.me.groups` | +| `data.coder_workspace.me.owner_oidc_access_token` | `data.coder_workspace_owner.me.oidc_access_token` | +| `data.coder_workspace.me.owner_session_token` | `data.coder_workspace_owner.me.session_token` | + +->While we do not anticipate these changes to affect existing resources, we strongly advice reviewing the plan produced by Terraform to ensure no resources are accidentally removed or altered in an undesired way. If you encounter any unexpected behavior, please report it by opening a GitHub [issue](https://github.com/coder/terraform-provider-coder/issues). From 1efcd776beed7e9892bed999482009574780607d Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 21 Nov 2024 12:49:29 +0500 Subject: [PATCH 4/5] Run `make gen` after updating migration guides --- docs/guides/v1-to-v2-migration.md | 45 --------- docs/guides/version-2-upgrade.md | 102 ++++++++++++++++++++ docs/index.md | 4 +- go.mod | 2 +- templates/guides/v1-to-v2-migration.md.tmpl | 45 --------- templates/guides/version-2-upgrade.md.tmpl | 102 ++++++++++++++++++++ templates/index.md.tmpl | 4 +- 7 files changed, 209 insertions(+), 95 deletions(-) delete mode 100644 docs/guides/v1-to-v2-migration.md create mode 100644 docs/guides/version-2-upgrade.md delete mode 100644 templates/guides/v1-to-v2-migration.md.tmpl create mode 100644 templates/guides/version-2-upgrade.md.tmpl diff --git a/docs/guides/v1-to-v2-migration.md b/docs/guides/v1-to-v2-migration.md deleted file mode 100644 index fd39dc90..00000000 --- a/docs/guides/v1-to-v2-migration.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -page_title: "Migrate from v1 to v2" ---- - -# Migrate from v1 to v2 - -Version 2.0.0 of the Coder provider for Terraform is a major release that removes the following deprecated data sources and their properties: - -- `coder_git_auth` data source -- All owner properties from the [`coder_workspace`](../docs/data-sources/workspace.md) data source - -## Migrating `coder_git_auth` data source - -If you are using this data source, you must replace it with the [`coder_external_auth`](../docs/data-sources/external-auth.md) data source. The `coder_external_auth` data source is a more generic data source that can be used to create any external authentication provider. - -### v1.0.0 -```terraform - -data "coder_git_auth" "example" { - id = "example" -} -``` -### v2.0.0 -```terraform -data "coder_external_auth" "example" { - id = "example" -} -``` - - -## Migrating `coder_workspace` data source - -If you are using the `owner` properties of the `coder_workspace` data source, you must remove them and use the `coder_workspace_owner` data source instead. The `coder_workspace_owner` data source is a more generic data source that provide additional properties of the workspace owner. - -| `v1.0.0` | `v2.0.0` | -|-----------|----------| -| `data.coder_workspace.me.owner_id` | `data.coder_workspace_owner.me.id` | -| `data.coder_workspace.me.owner` | `data.coder_workspace_owner.me.name` | -| `data.coder_workspace.me.owner_name` | `data.coder_workspace_owner.me.full_name` | -| `data.coder_workspace.me.owner_email` | `data.coder_workspace_owner.me.email` | -| `data.coder_workspace.me.owner_groups` | `data.coder_workspace_owner.me.groups` | -| `data.coder_workspace.me.owner_oidc_access_token` | `data.coder_workspace_owner.me.oidc_access_token` | -| `data.coder_workspace.me.owner_session_token` | `data.coder_workspace_owner.me.session_token` | - -->While we do not anticipate these changes to affect existing resources, we strongly advice reviewing the plan produced by Terraform to ensure no resources are accidentally removed or altered in an undesired way. If you encounter any unexpected behavior, please report it by opening a GitHub [issue](https://github.com/coder/terraform-provider-coder/issues). diff --git a/docs/guides/version-2-upgrade.md b/docs/guides/version-2-upgrade.md new file mode 100644 index 00000000..9419d8c1 --- /dev/null +++ b/docs/guides/version-2-upgrade.md @@ -0,0 +1,102 @@ +--- +page_title: "Terraform Coder Provider Version 2 Upgrade Guide" +--- + +# Terraform Coder Provider Version 2 Upgrade Guide + +Version 2.0.0 of the Coder provider for Terraform is a major release that removes and introduces some changes that you will need to consider when upgrading. +This guide is intended to help with the process and focus only on the changes from version 1.X to version 2.0.0. + + +!> Using Version 2.0.0 of the Coder provider requires Coder Server version [`2.13.0`](https://github.com/coder/coder/releases/tag/v2.13.0) or later. + +Upgrade topics: + +- [Provider Version Configuration](#provider-version-configuration) +- [Provider Arguments](#provider-arguments) +- [Data Source: coder_git_auth --> coder_external_auth](#data-source-coder_git_auth) +- [Data Source: coder_workspace](#data-source-coder_workspace) + +## Provider Version Configuration + +-> Before upgrading to version 2.0.0, it is recommended to upgrade to the most recent 1.X version and ensure that your environment successfully runs [`terraform plan`](https://developer.hashicorp.com/terraform/cli/commands/plan) without unexpected changes or deprecation notices. + +We recommended using [version constraints](https://developer.hashicorp.com/terraform/language/providers/requirements#version-constraints) when configuring Terraform providers. + + +For example, given the previous configuration: + +```terraform +terraform { + required_providers { + coder = { + source = "coder/coder" + version = "~> 1.0.0" + } + } +} + +provider "coder" { + feature_use_managed_variables = true +} +``` + +Update to the latest 2.X version: + +```terraform +terraform { + required_providers { + coder = { + source = "coder/coder" + version = "~> 2.0.0" + } + } +} + +provider "coder" {} +``` + +## Provider Arguments + +Version 2.0.0 removes the [`feature_use_managed_variables`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs#feature_use_managed_variables-1) argument from the `provider` block. + + +## Data Source: [`coder_git_auth`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs/data-sources/git_auth) + +If you are using this data source, you must replace it with the [`coder_external_auth`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/external_auth) data source. The `coder_external_auth` data source is a more generic data source that can be used to create any external authentication provider which supports OAuth2. + +For example, given the previous configuration: + +```terraform +data "coder_git_auth" "example" { + id = "example" +} +``` + +Update to the new data source: + +```terraform +data "coder_external_auth" "example" { + id = "example" +} +``` + +## Data Source: [`coder_workspace`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs/data-sources/workspace) + +If you are using the `owner` properties of the `coder_workspace` data source, you must remove them and use the [`coder_workspace_owner`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner) data source instead. The `coder_workspace_owner` data source provides additional properties of the workspace owner. + +Update your Terraform configuration to use the `coder_workspace_owner` data source instead and update the following attributes: + +```terraform +data "coder_workspace_owner" "me" {} +``` + +- Remove `owner_id` attribute. Use [`data.coder_workspace_owner.me.id`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#id) instead. +- Remove `owner` attribute. Use [`data.coder_workspace_owner.me.name`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#name) instead. +- Remove `owner_name` attribute. Use [`data.coder_workspace_owner.me.full_name`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#full_name) instead. +- Remove `owner_email` attribute. Use [`data.coder_workspace_owner.me.email`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#email) instead. +- Remove `owner_groups` attribute. Use [`data.coder_workspace_owner.me.groups`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#groups) instead. +- Remove `owner_oidc_access_token` attribute. Use [`data.coder_workspace_owner.me.oidc_access_token`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#oidc_access_token) instead. +- Remove `owner_session_token` attribute. Use [`data.coder_workspace_owner.me.session_token`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#session_token) instead. + +->While we do not anticipate these changes to affect existing resources, we strongly advice reviewing the plan produced by Terraform to ensure no resources are accidentally removed or altered in an undesired way. If you encounter any unexpected behavior, please report it by opening a GitHub [issue](https://github.com/coder/terraform-provider-coder/issues). \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index ce91f4c5..918dab37 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,11 +8,11 @@ description: |- # Coder Provider -Terraform provider for managing Coder [templates](https://coder.com/docs/templates), which are the underlying infrastructure for Coder [workspaces](https://coder.com/docs/workspaces). +Terraform provider for managing Coder [templates](https://coder.com/docs/admin/templates), which are the underlying infrastructure for Coder [workspaces](https://coder.com/docs/user-guides/workspace-management). -> Requires Coder v2.13.0 or later. -!> `coder_git_auth` and owner related fields of `coder_workspace` data source have been removed. Follow the [v0 to v1migration guide](https://registry.terraform.io/providers/codercom/coder/latest/docs/guides/v1-to-v2-migration) to update your code. +!> [`coder_git_auth`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs/data-sources/git_auth) and owner related fields of [`coder_workspace`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs/data-sources/workspace) data source have been removed. Follow the [Version 2 Upgrade Guide](https://registry.terraform.io/providers/codercom/coder/latest/docs/guides/version-2-upgrade) to update your code. ## Example diff --git a/go.mod b/go.mod index ec54a5e1..f4f40b67 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/coder/terraform-provider-coder go 1.22 -toolchain go1.22.3 +toolchain go1.22.9 require ( github.com/docker/docker v26.1.5+incompatible diff --git a/templates/guides/v1-to-v2-migration.md.tmpl b/templates/guides/v1-to-v2-migration.md.tmpl deleted file mode 100644 index fd39dc90..00000000 --- a/templates/guides/v1-to-v2-migration.md.tmpl +++ /dev/null @@ -1,45 +0,0 @@ ---- -page_title: "Migrate from v1 to v2" ---- - -# Migrate from v1 to v2 - -Version 2.0.0 of the Coder provider for Terraform is a major release that removes the following deprecated data sources and their properties: - -- `coder_git_auth` data source -- All owner properties from the [`coder_workspace`](../docs/data-sources/workspace.md) data source - -## Migrating `coder_git_auth` data source - -If you are using this data source, you must replace it with the [`coder_external_auth`](../docs/data-sources/external-auth.md) data source. The `coder_external_auth` data source is a more generic data source that can be used to create any external authentication provider. - -### v1.0.0 -```terraform - -data "coder_git_auth" "example" { - id = "example" -} -``` -### v2.0.0 -```terraform -data "coder_external_auth" "example" { - id = "example" -} -``` - - -## Migrating `coder_workspace` data source - -If you are using the `owner` properties of the `coder_workspace` data source, you must remove them and use the `coder_workspace_owner` data source instead. The `coder_workspace_owner` data source is a more generic data source that provide additional properties of the workspace owner. - -| `v1.0.0` | `v2.0.0` | -|-----------|----------| -| `data.coder_workspace.me.owner_id` | `data.coder_workspace_owner.me.id` | -| `data.coder_workspace.me.owner` | `data.coder_workspace_owner.me.name` | -| `data.coder_workspace.me.owner_name` | `data.coder_workspace_owner.me.full_name` | -| `data.coder_workspace.me.owner_email` | `data.coder_workspace_owner.me.email` | -| `data.coder_workspace.me.owner_groups` | `data.coder_workspace_owner.me.groups` | -| `data.coder_workspace.me.owner_oidc_access_token` | `data.coder_workspace_owner.me.oidc_access_token` | -| `data.coder_workspace.me.owner_session_token` | `data.coder_workspace_owner.me.session_token` | - -->While we do not anticipate these changes to affect existing resources, we strongly advice reviewing the plan produced by Terraform to ensure no resources are accidentally removed or altered in an undesired way. If you encounter any unexpected behavior, please report it by opening a GitHub [issue](https://github.com/coder/terraform-provider-coder/issues). diff --git a/templates/guides/version-2-upgrade.md.tmpl b/templates/guides/version-2-upgrade.md.tmpl new file mode 100644 index 00000000..9419d8c1 --- /dev/null +++ b/templates/guides/version-2-upgrade.md.tmpl @@ -0,0 +1,102 @@ +--- +page_title: "Terraform Coder Provider Version 2 Upgrade Guide" +--- + +# Terraform Coder Provider Version 2 Upgrade Guide + +Version 2.0.0 of the Coder provider for Terraform is a major release that removes and introduces some changes that you will need to consider when upgrading. +This guide is intended to help with the process and focus only on the changes from version 1.X to version 2.0.0. + + +!> Using Version 2.0.0 of the Coder provider requires Coder Server version [`2.13.0`](https://github.com/coder/coder/releases/tag/v2.13.0) or later. + +Upgrade topics: + +- [Provider Version Configuration](#provider-version-configuration) +- [Provider Arguments](#provider-arguments) +- [Data Source: coder_git_auth --> coder_external_auth](#data-source-coder_git_auth) +- [Data Source: coder_workspace](#data-source-coder_workspace) + +## Provider Version Configuration + +-> Before upgrading to version 2.0.0, it is recommended to upgrade to the most recent 1.X version and ensure that your environment successfully runs [`terraform plan`](https://developer.hashicorp.com/terraform/cli/commands/plan) without unexpected changes or deprecation notices. + +We recommended using [version constraints](https://developer.hashicorp.com/terraform/language/providers/requirements#version-constraints) when configuring Terraform providers. + + +For example, given the previous configuration: + +```terraform +terraform { + required_providers { + coder = { + source = "coder/coder" + version = "~> 1.0.0" + } + } +} + +provider "coder" { + feature_use_managed_variables = true +} +``` + +Update to the latest 2.X version: + +```terraform +terraform { + required_providers { + coder = { + source = "coder/coder" + version = "~> 2.0.0" + } + } +} + +provider "coder" {} +``` + +## Provider Arguments + +Version 2.0.0 removes the [`feature_use_managed_variables`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs#feature_use_managed_variables-1) argument from the `provider` block. + + +## Data Source: [`coder_git_auth`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs/data-sources/git_auth) + +If you are using this data source, you must replace it with the [`coder_external_auth`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/external_auth) data source. The `coder_external_auth` data source is a more generic data source that can be used to create any external authentication provider which supports OAuth2. + +For example, given the previous configuration: + +```terraform +data "coder_git_auth" "example" { + id = "example" +} +``` + +Update to the new data source: + +```terraform +data "coder_external_auth" "example" { + id = "example" +} +``` + +## Data Source: [`coder_workspace`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs/data-sources/workspace) + +If you are using the `owner` properties of the `coder_workspace` data source, you must remove them and use the [`coder_workspace_owner`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner) data source instead. The `coder_workspace_owner` data source provides additional properties of the workspace owner. + +Update your Terraform configuration to use the `coder_workspace_owner` data source instead and update the following attributes: + +```terraform +data "coder_workspace_owner" "me" {} +``` + +- Remove `owner_id` attribute. Use [`data.coder_workspace_owner.me.id`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#id) instead. +- Remove `owner` attribute. Use [`data.coder_workspace_owner.me.name`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#name) instead. +- Remove `owner_name` attribute. Use [`data.coder_workspace_owner.me.full_name`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#full_name) instead. +- Remove `owner_email` attribute. Use [`data.coder_workspace_owner.me.email`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#email) instead. +- Remove `owner_groups` attribute. Use [`data.coder_workspace_owner.me.groups`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#groups) instead. +- Remove `owner_oidc_access_token` attribute. Use [`data.coder_workspace_owner.me.oidc_access_token`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#oidc_access_token) instead. +- Remove `owner_session_token` attribute. Use [`data.coder_workspace_owner.me.session_token`](https://registry.terraform.io/providers/coder/coder/2.0.0/docs/data-sources/workspace_owner#session_token) instead. + +->While we do not anticipate these changes to affect existing resources, we strongly advice reviewing the plan produced by Terraform to ensure no resources are accidentally removed or altered in an undesired way. If you encounter any unexpected behavior, please report it by opening a GitHub [issue](https://github.com/coder/terraform-provider-coder/issues). \ No newline at end of file diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl index d9780374..7ad932f5 100644 --- a/templates/index.md.tmpl +++ b/templates/index.md.tmpl @@ -8,11 +8,11 @@ description: |- # Coder Provider -Terraform provider for managing Coder [templates](https://coder.com/docs/templates), which are the underlying infrastructure for Coder [workspaces](https://coder.com/docs/workspaces). +Terraform provider for managing Coder [templates](https://coder.com/docs/admin/templates), which are the underlying infrastructure for Coder [workspaces](https://coder.com/docs/user-guides/workspace-management). -> Requires Coder v2.13.0 or later. -!> `coder_git_auth` and owner related fields of `coder_workspace` data source have been removed. Follow the [v0 to v1migration guide](https://registry.terraform.io/providers/codercom/coder/latest/docs/guides/v1-to-v2-migration) to update your code. +!> [`coder_git_auth`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs/data-sources/git_auth) and owner related fields of [`coder_workspace`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs/data-sources/workspace) data source have been removed. Follow the [Version 2 Upgrade Guide](https://registry.terraform.io/providers/codercom/coder/latest/docs/guides/version-2-upgrade) to update your code. ## Example From 87ad4f778b4c6c820d9924d23a38d1ce44ca9eba Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Mon, 25 Nov 2024 22:54:25 +0500 Subject: [PATCH 5/5] review suggestions --- docs/guides/version-2-upgrade.md | 11 +++++------ docs/index.md | 2 +- templates/guides/version-2-upgrade.md.tmpl | 11 +++++------ templates/index.md.tmpl | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/guides/version-2-upgrade.md b/docs/guides/version-2-upgrade.md index 9419d8c1..49e262e1 100644 --- a/docs/guides/version-2-upgrade.md +++ b/docs/guides/version-2-upgrade.md @@ -4,11 +4,10 @@ page_title: "Terraform Coder Provider Version 2 Upgrade Guide" # Terraform Coder Provider Version 2 Upgrade Guide -Version 2.0.0 of the Coder provider for Terraform is a major release that removes and introduces some changes that you will need to consider when upgrading. -This guide is intended to help with the process and focus only on the changes from version 1.X to version 2.0.0. +Version 2.0.0 of the Coder provider for Terraform is a major release that introduces some changes that you will need to consider when upgrading. +This guide is intended to help with the process, and focuses only on the changes from version 1.X to version 2.0.0. - -!> Using Version 2.0.0 of the Coder provider requires Coder Server version [`2.13.0`](https://github.com/coder/coder/releases/tag/v2.13.0) or later. +!> Using Version 2.0.0 of the Coder provider requires Coder Server version [`2.18.0`](https://github.com/coder/coder/releases/tag/v2.18.0) or later. Upgrade topics: @@ -19,9 +18,9 @@ Upgrade topics: ## Provider Version Configuration --> Before upgrading to version 2.0.0, it is recommended to upgrade to the most recent 1.X version and ensure that your environment successfully runs [`terraform plan`](https://developer.hashicorp.com/terraform/cli/commands/plan) without unexpected changes or deprecation notices. +-> Before upgrading to version 2.0.0, please first upgrade to the most recent 1.X version and ensure that your environment successfully runs [`terraform plan`](https://developer.hashicorp.com/terraform/cli/commands/plan) without unexpected changes or deprecation notices. -We recommended using [version constraints](https://developer.hashicorp.com/terraform/language/providers/requirements#version-constraints) when configuring Terraform providers. +We highly recommend using [version constraints](https://developer.hashicorp.com/terraform/language/providers/requirements#version-constraints) when configuring Terraform providers. For example, given the previous configuration: diff --git a/docs/index.md b/docs/index.md index 918dab37..ec7be2d8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,7 +10,7 @@ description: |- Terraform provider for managing Coder [templates](https://coder.com/docs/admin/templates), which are the underlying infrastructure for Coder [workspaces](https://coder.com/docs/user-guides/workspace-management). --> Requires Coder v2.13.0 or later. +-> Requires Coder [v2.18.0](https://github.com/coder/coder/releases/tag/v2.18.0) or later. !> [`coder_git_auth`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs/data-sources/git_auth) and owner related fields of [`coder_workspace`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs/data-sources/workspace) data source have been removed. Follow the [Version 2 Upgrade Guide](https://registry.terraform.io/providers/codercom/coder/latest/docs/guides/version-2-upgrade) to update your code. diff --git a/templates/guides/version-2-upgrade.md.tmpl b/templates/guides/version-2-upgrade.md.tmpl index 9419d8c1..49e262e1 100644 --- a/templates/guides/version-2-upgrade.md.tmpl +++ b/templates/guides/version-2-upgrade.md.tmpl @@ -4,11 +4,10 @@ page_title: "Terraform Coder Provider Version 2 Upgrade Guide" # Terraform Coder Provider Version 2 Upgrade Guide -Version 2.0.0 of the Coder provider for Terraform is a major release that removes and introduces some changes that you will need to consider when upgrading. -This guide is intended to help with the process and focus only on the changes from version 1.X to version 2.0.0. +Version 2.0.0 of the Coder provider for Terraform is a major release that introduces some changes that you will need to consider when upgrading. +This guide is intended to help with the process, and focuses only on the changes from version 1.X to version 2.0.0. - -!> Using Version 2.0.0 of the Coder provider requires Coder Server version [`2.13.0`](https://github.com/coder/coder/releases/tag/v2.13.0) or later. +!> Using Version 2.0.0 of the Coder provider requires Coder Server version [`2.18.0`](https://github.com/coder/coder/releases/tag/v2.18.0) or later. Upgrade topics: @@ -19,9 +18,9 @@ Upgrade topics: ## Provider Version Configuration --> Before upgrading to version 2.0.0, it is recommended to upgrade to the most recent 1.X version and ensure that your environment successfully runs [`terraform plan`](https://developer.hashicorp.com/terraform/cli/commands/plan) without unexpected changes or deprecation notices. +-> Before upgrading to version 2.0.0, please first upgrade to the most recent 1.X version and ensure that your environment successfully runs [`terraform plan`](https://developer.hashicorp.com/terraform/cli/commands/plan) without unexpected changes or deprecation notices. -We recommended using [version constraints](https://developer.hashicorp.com/terraform/language/providers/requirements#version-constraints) when configuring Terraform providers. +We highly recommend using [version constraints](https://developer.hashicorp.com/terraform/language/providers/requirements#version-constraints) when configuring Terraform providers. For example, given the previous configuration: diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl index 7ad932f5..be92b931 100644 --- a/templates/index.md.tmpl +++ b/templates/index.md.tmpl @@ -10,7 +10,7 @@ description: |- Terraform provider for managing Coder [templates](https://coder.com/docs/admin/templates), which are the underlying infrastructure for Coder [workspaces](https://coder.com/docs/user-guides/workspace-management). --> Requires Coder v2.13.0 or later. +-> Requires Coder [v2.18.0](https://github.com/coder/coder/releases/tag/v2.18.0) or later. !> [`coder_git_auth`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs/data-sources/git_auth) and owner related fields of [`coder_workspace`](https://registry.terraform.io/providers/coder/coder/1.0.4/docs/data-sources/workspace) data source have been removed. Follow the [Version 2 Upgrade Guide](https://registry.terraform.io/providers/codercom/coder/latest/docs/guides/version-2-upgrade) to update your code.