2023-03-30 10:01:09 +00:00
|
|
|
package terraform
|
|
|
|
|
2024-04-02 12:56:27 +00:00
|
|
|
import (
|
|
|
|
"github.com/databricks/cli/bundle/internal/tf/schema"
|
|
|
|
"github.com/hashicorp/go-version"
|
|
|
|
)
|
|
|
|
|
2023-03-30 10:01:09 +00:00
|
|
|
const TerraformStateFileName = "terraform.tfstate"
|
2024-03-01 08:25:12 +00:00
|
|
|
const TerraformConfigFileName = "bundle.tf.json"
|
2024-04-02 12:56:27 +00:00
|
|
|
|
|
|
|
// Users can provide their own terraform binary and databricks terraform provider by setting the following environment variables.
|
|
|
|
// This allows users to use the CLI in an air-gapped environments. See the `debug terraform` command.
|
|
|
|
const TerraformExecPathEnv = "DATABRICKS_TF_EXEC_PATH"
|
|
|
|
const TerraformVersionEnv = "DATABRICKS_TF_VERSION"
|
|
|
|
const TerraformCliConfigPathEnv = "DATABRICKS_TF_CLI_CONFIG_FILE"
|
|
|
|
const TerraformProviderVersionEnv = "DATABRICKS_TF_PROVIDER_VERSION"
|
|
|
|
|
|
|
|
var TerraformVersion = version.Must(version.NewVersion("1.5.5"))
|
|
|
|
|
|
|
|
type TerraformMetadata struct {
|
|
|
|
Version string `json:"version"`
|
|
|
|
ProviderHost string `json:"providerHost"`
|
|
|
|
ProviderSource string `json:"providerSource"`
|
|
|
|
ProviderVersion string `json:"providerVersion"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewTerraformMetadata() *TerraformMetadata {
|
|
|
|
return &TerraformMetadata{
|
|
|
|
Version: TerraformVersion.String(),
|
|
|
|
ProviderHost: schema.ProviderHost,
|
|
|
|
ProviderSource: schema.ProviderSource,
|
|
|
|
ProviderVersion: schema.ProviderVersion,
|
|
|
|
}
|
|
|
|
}
|