page_title |
---|
Terraform Coder Provider Version 2 Upgrade Guide |
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.18.0
or later.
Upgrade topics:
- Provider Version Configuration
- Provider Arguments
- Data Source: coder_git_auth --> coder_external_auth
- Data Source: coder_workspace
-> 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
without unexpected changes or deprecation notices.
We highly recommend using version constraints when configuring Terraform providers.
For example, given the previous configuration:
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 {
required_providers {
coder = {
source = "coder/coder"
version = "~> 2.0.0"
}
}
}
provider "coder" {}
Version 2.0.0 removes the feature_use_managed_variables
argument from the provider
block.
Data Source: coder_git_auth
If you are using this data source, you must replace it with the coder_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:
data "coder_git_auth" "example" {
id = "example"
}
Update to the new data source:
data "coder_external_auth" "example" {
id = "example"
}
Data Source: coder_workspace
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 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:
data "coder_workspace_owner" "me" {}
- Remove
owner_id
attribute. Usedata.coder_workspace_owner.me.id
instead. - Remove
owner
attribute. Usedata.coder_workspace_owner.me.name
instead. - Remove
owner_name
attribute. Usedata.coder_workspace_owner.me.full_name
instead. - Remove
owner_email
attribute. Usedata.coder_workspace_owner.me.email
instead. - Remove
owner_groups
attribute. Usedata.coder_workspace_owner.me.groups
instead. - Remove
owner_oidc_access_token
attribute. Usedata.coder_workspace_owner.me.oidc_access_token
instead. - Remove
owner_session_token
attribute. Usedata.coder_workspace_owner.me.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.