You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// We must record a value into the backend state file, and we cannot include a value that changes (e.g. the Terraform core binary version) as migration
1699
1700
// is impossible with builtin providers.
1700
1701
// So, we use an arbitrary stand-in version.
1702
+
standInVersion, err:=version.NewVersion("0.0.1")
1703
+
iferr!=nil {
1704
+
diags=diags.Append(fmt.Errorf("Error when creating a backend state file. This is a bug in Terraform and should be reported: %w",
diags=diags.Append(fmt.Errorf("Error determining if the state storage provider is reattached or not. This is a bug in Terraform and should be reported: %w",
1713
+
err))
1714
+
returnnil, diags
1715
+
}
1716
+
ifisReattached {
1717
+
// If the provider is unmanaged then it won't be in the locks.
1718
+
// If there are no locks then there's no version information to for us to access and use when creating the backend state file.
1719
+
// So, we use an arbitrary stand-in version.
1720
+
diags=diags.Append(&hcl.Diagnostic{
1721
+
Severity: hcl.DiagWarning,
1722
+
Summary: "State storage provider is not managed by Terraform",
1723
+
Detail: "Terraform is using a provider supplied via TF_REATTACH_PROVIDERS for initializing state storage. This will affect Terraform's ability to detect when state migrations are required.",
1724
+
})
1701
1725
standInVersion, err:=version.NewVersion("0.0.1")
1702
1726
iferr!=nil {
1703
1727
diags=diags.Append(fmt.Errorf("Error when creating a backend state file. This is a bug in Terraform and should be reported: %w",
diags=diags.Append(fmt.Errorf("Failed obtain the in-use version of provider %s (%q) when recording backend state for state store %q. This is a bug in Terraform and should be reported: %w",
0 commit comments