Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: coder/terraform-provider-coderd
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.5
Choose a base ref
...
head repository: coder/terraform-provider-coderd
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.0.6
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Oct 18, 2024

  1. Configuration menu
    Copy the full SHA
    7bbfc7f View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2024

  1. fix: skip validating unknown versions list (#115)

    This fixes an error when setting the `versions` attribute of a
    `coderd_template` using a variable, e.g:
    
    ```terraform
    resource "coderd_template" "dev" {
        versions = var.template_versions
        [...]
    }
    
    variable "template_versions" {
      description = "Versions of the Coder template."
      default = [
        {
          directory   = "modules/"
          active      = true
          tf_vars     = [
              {
                  name  = "coder_instance"
                  value = "prod"
              }
          ]
        }
      ]
    }
    ```
    
    would return:
    ```
    │ Error: Value Conversion Error
    │
    │   with module.devcontainers.coderd_template.dev,
    │ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider
    │ developer:
    │
    │ Received unknown value, however the target type cannot handle unknown values. Use the corresponding `types` package type or a custom type that handles
    │ unknown values.
    │
    │ Path:
    │ Target Type: []provider.TemplateVersion
    │ Suggested Type: basetypes.ListValue
    ```
    
    This error was caused by attempting to validate the versions list
    without checking if the config value is unknown. Normally, this value
    should never be unknown, as it's required, but it looks like Terraform
    does a configuration validation *before* variables are populated, as
    well as after.
    
    To confirm this is the correct solution, we see that all the default
    validators perform the same null & unknown checks, e.g:
    ```go
    func (v lengthBetweenValidator) ValidateString(ctx context.Context, request validator.StringRequest, response *validator.StringResponse) {
    	if request.ConfigValue.IsNull() || request.ConfigValue.IsUnknown() {
    		return
    	}
    	...
    }
    ```
    ethanndickson authored Oct 21, 2024
    Configuration menu
    Copy the full SHA
    269046e View commit details
    Browse the repository at this point in the history
Loading