Tweak configuration copy for TFC
This aligns more with the existing copy for backends
This commit is contained in:
parent
fabd8eb0b6
commit
2c0294c7e3
|
@ -597,11 +597,11 @@ func (m *Meta) backendFromConfig(opts *BackendOpts) (backend.Backend, tfdiags.Di
|
||||||
log.Printf("[TRACE] Meta.Backend: moving from default local state only to %q backend", c.Type)
|
log.Printf("[TRACE] Meta.Backend: moving from default local state only to %q backend", c.Type)
|
||||||
if !opts.Init {
|
if !opts.Init {
|
||||||
if c.Type == "cloud" {
|
if c.Type == "cloud" {
|
||||||
// NOTE: There may be an implicit local backend with state that is not visible to this block.
|
initReason := "Initial configuration of Terraform Cloud"
|
||||||
diags = diags.Append(tfdiags.Sourceless(
|
diags = diags.Append(tfdiags.Sourceless(
|
||||||
tfdiags.Error,
|
tfdiags.Error,
|
||||||
"Terraform Cloud has been configured but needs to be initialized.",
|
"Terraform Cloud initialization required, please run \"terraform init\"",
|
||||||
strings.TrimSpace(errBackendInitCloud),
|
fmt.Sprintf(strings.TrimSpace(errBackendInitCloud), initReason),
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
initReason := fmt.Sprintf("Initial configuration of the requested backend %q", c.Type)
|
initReason := fmt.Sprintf("Initial configuration of the requested backend %q", c.Type)
|
||||||
|
@ -649,8 +649,8 @@ func (m *Meta) backendFromConfig(opts *BackendOpts) (backend.Backend, tfdiags.Di
|
||||||
if c.Type == "cloud" {
|
if c.Type == "cloud" {
|
||||||
diags = diags.Append(tfdiags.Sourceless(
|
diags = diags.Append(tfdiags.Sourceless(
|
||||||
tfdiags.Error,
|
tfdiags.Error,
|
||||||
"Terraform Cloud has been configured but needs to be initialized.",
|
"Terraform Cloud initialization required, please run \"terraform init\"",
|
||||||
strings.TrimSpace(errBackendInitCloud),
|
fmt.Sprintf(strings.TrimSpace(errBackendInitCloud), initReason),
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
diags = diags.Append(tfdiags.Sourceless(
|
diags = diags.Append(tfdiags.Sourceless(
|
||||||
|
@ -1328,17 +1328,12 @@ configuration or state have been made.
|
||||||
`
|
`
|
||||||
|
|
||||||
const errBackendInitCloud = `
|
const errBackendInitCloud = `
|
||||||
Changes to the Terraform Cloud configuration block require reinitialization.
|
Reason: %s
|
||||||
This allows Terraform to set up the new configuration, copy existing state,
|
|
||||||
etc. Learn more about Terraform Settings:
|
|
||||||
https://www.terraform.io/docs/language/settings/index.html
|
|
||||||
|
|
||||||
|
Changes to the Terraform Cloud configuration block require reinitialization.
|
||||||
|
This allows Terraform to set up the new configuration, copy existing state, etc.
|
||||||
Please run "terraform init" with either the "-reconfigure" or "-migrate-state"
|
Please run "terraform init" with either the "-reconfigure" or "-migrate-state"
|
||||||
flags. The "-reconfigure" option disregards any existing configuration,
|
flags to use the current configuration.
|
||||||
preventing migration of any existing state. The "-migrate-state" option
|
|
||||||
will attempt to copy existing state to Terraform Cloud. Learn more about
|
|
||||||
using "terraform init":
|
|
||||||
https://www.terraform.io/docs/cli/commands/init.html#backend-initialization
|
|
||||||
|
|
||||||
If the change reason above is incorrect, please verify your configuration
|
If the change reason above is incorrect, please verify your configuration
|
||||||
hasn't changed and try again. At this point, no changes to your existing
|
hasn't changed and try again. At this point, no changes to your existing
|
||||||
|
|
Loading…
Reference in New Issue