From 20aa24e09f029680c27f3665d7ff124237ac0174 Mon Sep 17 00:00:00 2001 From: James Pogran Date: Mon, 20 Mar 2023 11:14:43 -0400 Subject: [PATCH] Fix remote backend tracking (#1218) Previously we would submit an empty backend if the configuration used the default value. This detects an empty value and uses the default "app.terraform.io" value instead. --- internal/langserver/handlers/hooks_module.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/langserver/handlers/hooks_module.go b/internal/langserver/handlers/hooks_module.go index b06cea6fe..125a934ba 100644 --- a/internal/langserver/handlers/hooks_module.go +++ b/internal/langserver/handlers/hooks_module.go @@ -68,8 +68,14 @@ func moduleTelemetryData(mod *state.Module, ch state.ModuleChanges, store *state if data, ok := mod.Meta.Backend.Data.(*backend.Remote); ok { hostname := data.Hostname + // https://developer.hashicorp.com/terraform/language/settings/backends/remote#hostname + // Defaults to app.terraform.io for Terraform Cloud + if hostname == "" { + hostname = "app.terraform.io" + } + // anonymize any non-default hostnames - if hostname != "" && hostname != "app.terraform.io" { + if hostname != "app.terraform.io" { hostname = "custom-hostname" }