Merge pull request #135 from opentffoundation/update-internal-terraform

This commit is contained in:
Elbaz 2023-08-23 15:47:04 +03:00 committed by GitHub
commit 0774b3d4d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 70 additions and 71 deletions

View File

@ -932,7 +932,7 @@ configuration.
The -target option is not for routine use, and is provided only for
exceptional situations such as recovering from errors or mistakes, or when
Terraform specifically suggests to use it as part of an error message.
OpenTF specifically suggests to use it as part of an error message.
Warning: Applied changes may be incomplete
@ -940,12 +940,11 @@ The plan was created with the -target option in effect, so some changes
requested in the configuration may have been ignored and the output values
may not be fully updated. Run the following command to verify that no other
changes are pending:
terraform plan
opentf plan
Note that the -target option is not suitable for routine use, and is provided
only for exceptional situations such as recovering from errors or mistakes,
or when Terraform specifically suggests to use it as part of an error
message.
or when OpenTF specifically suggests to use it as part of an error message.
run "second"... pass
Success! 2 passed, 0 failed.

View File

@ -172,14 +172,14 @@ type ContextGraphOpts struct {
//
// Stop will block until the task completes.
func (c *Context) Stop() {
log.Printf("[WARN] terraform: Stop called, initiating interrupt sequence")
log.Printf("[WARN] opentf: Stop called, initiating interrupt sequence")
c.l.Lock()
defer c.l.Unlock()
// If we're running, then stop
if c.runContextCancel != nil {
log.Printf("[WARN] terraform: run context exists, stopping")
log.Printf("[WARN] opentf: run context exists, stopping")
// Tell the hook we want to stop
c.sh.Stop()
@ -197,11 +197,11 @@ func (c *Context) Stop() {
// Grab the condition var before we exit
if cond := c.runCond; cond != nil {
log.Printf("[INFO] terraform: waiting for graceful stop to complete")
log.Printf("[INFO] opentf: waiting for graceful stop to complete")
cond.Wait()
}
log.Printf("[WARN] terraform: stop complete")
log.Printf("[WARN] opentf: stop complete")
}
func (c *Context) acquireRun(phase string) func() {
@ -359,18 +359,18 @@ func (c *Context) checkConfigDependencies(config *configs.Config) tfdiags.Diagno
tfdiags.Error,
"Missing required provider",
fmt.Sprintf(
"This configuration requires provider %s, but that provider isn't available. You may be able to install it automatically by running:\n terraform init",
"This configuration requires provider %s, but that provider isn't available. You may be able to install it automatically by running:\n opentf init",
providerAddr,
),
))
} else {
// Built-in providers can never be installed by "terraform init",
// Built-in providers can never be installed by "opentf init",
// so no point in confusing the user by suggesting that.
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Missing required provider",
fmt.Sprintf(
"This configuration requires built-in provider %s, but that provider isn't available in this Terraform version.",
"This configuration requires built-in provider %s, but that provider isn't available in this OpenTF version.",
providerAddr,
),
))
@ -401,7 +401,7 @@ func (c *Context) checkConfigDependencies(config *configs.Config) tfdiags.Diagno
tfdiags.Error,
"Missing required provisioner plugin",
fmt.Sprintf(
"This configuration requires provisioner plugin %q, which isn't available. If you're intending to use an external provisioner plugin, you must install it manually into one of the plugin search directories before running Terraform.",
"This configuration requires provisioner plugin %q, which isn't available. If you're intending to use an external provisioner plugin, you must install it manually into one of the plugin search directories before running OpenTF.",
pc.Type,
),
))

View File

@ -93,9 +93,9 @@ func (c *Context) Apply(plan *plans.Plan, config *configs.Config) (*states.State
tfdiags.Warning,
"Applied changes may be incomplete",
`The plan was created with the -target option in effect, so some changes requested in the configuration may have been ignored and the output values may not be fully updated. Run the following command to verify that no other changes are pending:
terraform plan
opentf plan
Note that the -target option is not suitable for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.`,
Note that the -target option is not suitable for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when OpenTF specifically suggests to use it as part of an error message.`,
))
}

View File

@ -1707,7 +1707,7 @@ func TestContext2Apply_destroyData(t *testing.T) {
func TestContext2Apply_destroySkipsCBD(t *testing.T) {
// Config contains CBD resource depending on non-CBD resource, which triggers
// a cycle if they are both replaced, but should _not_ trigger a cycle when
// just doing a `terraform destroy`.
// just doing a `opentf destroy`.
m := testModule(t, "apply-destroy-cbd")
p := testProvider("aws")
p.PlanResourceChangeFn = testDiffFn

View File

@ -143,17 +143,17 @@ func (c *Context) Plan(config *configs.Config, prevRunState *states.State, opts
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Incompatible plan options",
"Cannot skip refreshing in refresh-only mode. This is a bug in Terraform.",
"Cannot skip refreshing in refresh-only mode. This is a bug in OpenTF.",
))
return nil, diags
}
default:
// The CLI layer (and other similar callers) should not try to
// create a context for a mode that Terraform Core doesn't support.
// create a context for a mode that OpenTF Core doesn't support.
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Unsupported plan mode",
fmt.Sprintf("Terraform Core doesn't know how to handle plan mode %s. This is a bug in Terraform.", opts.Mode),
fmt.Sprintf("OpenTF Core doesn't know how to handle plan mode %s. This is a bug in OpenTF.", opts.Mode),
))
return nil, diags
}
@ -184,7 +184,7 @@ func (c *Context) Plan(config *configs.Config, prevRunState *states.State, opts
"Resource targeting is in effect",
`You are creating a plan with the -target option, which means that the result of this plan may not represent all of the changes requested by the current configuration.
The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.`,
The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when OpenTF specifically suggests to use it as part of an error message.`,
))
}
@ -343,7 +343,7 @@ func (c *Context) refreshOnlyPlan(config *configs.Config, prevRunState *states.S
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Invalid refresh-only plan",
"Terraform generated planned resource changes in a refresh-only plan. This is a bug in Terraform.",
"OpenTF generated planned resource changes in a refresh-only plan. This is a bug in OpenTF.",
))
}
@ -511,7 +511,7 @@ func (c *Context) prePlanVerifyTargetedMoves(moveResults refactoring.MoveResults
tfdiags.Error,
"Moved resource instances excluded by targeting",
fmt.Sprintf(
"Resource instances in your current state have moved to new addresses in the latest configuration. Terraform must include those resource instances while planning in order to ensure a correct result, but your -target=... options do not fully cover all of those resource instances.\n\nTo create a valid plan, either remove your -target=... options altogether or add the following additional target options:%s\n\nNote that adding these options may include further additional resource instances in your plan, in order to respect object dependencies.",
"Resource instances in your current state have moved to new addresses in the latest configuration. OpenTF must include those resource instances while planning in order to ensure a correct result, but your -target=... options do not fully cover all of those resource instances.\n\nTo create a valid plan, either remove your -target=... options altogether or add the following additional target options:%s\n\nNote that adding these options may include further additional resource instances in your plan, in order to respect object dependencies.",
listBuf.String(),
),
))
@ -892,7 +892,7 @@ func blockedMovesWarningDiag(results refactoring.MoveResults) tfdiags.Diagnostic
tfdiags.Warning,
"Unresolved resource instance address changes",
fmt.Sprintf(
"Terraform tried to adjust resource instance addresses in the prior state based on change information recorded in the configuration, but some adjustments did not succeed due to existing objects already at the intended addresses:%s\n\nTerraform has planned to destroy these objects. If Terraform's proposed changes aren't appropriate, you must first resolve the conflicts using the \"terraform state\" subcommands and then create a new plan.",
"OpenTF tried to adjust resource instance addresses in the prior state based on change information recorded in the configuration, but some adjustments did not succeed due to existing objects already at the intended addresses:%s\n\nOpenTF has planned to destroy these objects. If OpenTF's proposed changes aren't appropriate, you must first resolve the conflicts using the \"opentf state\" subcommands and then create a new plan.",
itemsBuf.String(),
),
)

View File

@ -1352,10 +1352,10 @@ func TestContext2Plan_movedResourceCollision(t *testing.T) {
tfdiags.Sourceless(
tfdiags.Warning,
"Unresolved resource instance address changes",
`Terraform tried to adjust resource instance addresses in the prior state based on change information recorded in the configuration, but some adjustments did not succeed due to existing objects already at the intended addresses:
`OpenTF tried to adjust resource instance addresses in the prior state based on change information recorded in the configuration, but some adjustments did not succeed due to existing objects already at the intended addresses:
- test_object.a[0] could not move to test_object.a
Terraform has planned to destroy these objects. If Terraform's proposed changes aren't appropriate, you must first resolve the conflicts using the "terraform state" subcommands and then create a new plan.`,
OpenTF has planned to destroy these objects. If OpenTF's proposed changes aren't appropriate, you must first resolve the conflicts using the "opentf state" subcommands and then create a new plan.`,
),
}.ForRPC()
if diff := cmp.Diff(wantDiags, gotDiags); diff != "" {
@ -1459,16 +1459,16 @@ func TestContext2Plan_movedResourceCollisionDestroy(t *testing.T) {
tfdiags.Warning,
"Unresolved resource instance address changes",
// NOTE: This message is _lightly_ confusing in the destroy case,
// because it says "Terraform has planned to destroy these objects"
// because it says "OpenTF has planned to destroy these objects"
// but this is a plan to destroy all objects, anyway. We expect the
// conflict situation to be pretty rare though, and even rarer in
// a "terraform destroy", so we'll just live with that for now
// a "opentf destroy", so we'll just live with that for now
// unless we see evidence that lots of folks are being confused by
// it in practice.
`Terraform tried to adjust resource instance addresses in the prior state based on change information recorded in the configuration, but some adjustments did not succeed due to existing objects already at the intended addresses:
`OpenTF tried to adjust resource instance addresses in the prior state based on change information recorded in the configuration, but some adjustments did not succeed due to existing objects already at the intended addresses:
- test_object.a[0] could not move to test_object.a
Terraform has planned to destroy these objects. If Terraform's proposed changes aren't appropriate, you must first resolve the conflicts using the "terraform state" subcommands and then create a new plan.`,
OpenTF has planned to destroy these objects. If OpenTF's proposed changes aren't appropriate, you must first resolve the conflicts using the "opentf state" subcommands and then create a new plan.`,
),
}.ForRPC()
if diff := cmp.Diff(wantDiags, gotDiags); diff != "" {
@ -1573,12 +1573,12 @@ func TestContext2Plan_movedResourceUntargeted(t *testing.T) {
"Resource targeting is in effect",
`You are creating a plan with the -target option, which means that the result of this plan may not represent all of the changes requested by the current configuration.
The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.`,
The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when OpenTF specifically suggests to use it as part of an error message.`,
),
tfdiags.Sourceless(
tfdiags.Error,
"Moved resource instances excluded by targeting",
`Resource instances in your current state have moved to new addresses in the latest configuration. Terraform must include those resource instances while planning in order to ensure a correct result, but your -target=... options do not fully cover all of those resource instances.
`Resource instances in your current state have moved to new addresses in the latest configuration. OpenTF must include those resource instances while planning in order to ensure a correct result, but your -target=... options do not fully cover all of those resource instances.
To create a valid plan, either remove your -target=... options altogether or add the following additional target options:
-target="test_object.a"
@ -1613,12 +1613,12 @@ Note that adding these options may include further additional resource instances
"Resource targeting is in effect",
`You are creating a plan with the -target option, which means that the result of this plan may not represent all of the changes requested by the current configuration.
The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.`,
The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when OpenTF specifically suggests to use it as part of an error message.`,
),
tfdiags.Sourceless(
tfdiags.Error,
"Moved resource instances excluded by targeting",
`Resource instances in your current state have moved to new addresses in the latest configuration. Terraform must include those resource instances while planning in order to ensure a correct result, but your -target=... options do not fully cover all of those resource instances.
`Resource instances in your current state have moved to new addresses in the latest configuration. OpenTF must include those resource instances while planning in order to ensure a correct result, but your -target=... options do not fully cover all of those resource instances.
To create a valid plan, either remove your -target=... options altogether or add the following additional target options:
-target="test_object.b"
@ -1653,12 +1653,12 @@ Note that adding these options may include further additional resource instances
"Resource targeting is in effect",
`You are creating a plan with the -target option, which means that the result of this plan may not represent all of the changes requested by the current configuration.
The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.`,
The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when OpenTF specifically suggests to use it as part of an error message.`,
),
tfdiags.Sourceless(
tfdiags.Error,
"Moved resource instances excluded by targeting",
`Resource instances in your current state have moved to new addresses in the latest configuration. Terraform must include those resource instances while planning in order to ensure a correct result, but your -target=... options do not fully cover all of those resource instances.
`Resource instances in your current state have moved to new addresses in the latest configuration. OpenTF must include those resource instances while planning in order to ensure a correct result, but your -target=... options do not fully cover all of those resource instances.
To create a valid plan, either remove your -target=... options altogether or add the following additional target options:
-target="test_object.a"
@ -1701,7 +1701,7 @@ Note that adding these options may include further additional resource instances
"Resource targeting is in effect",
`You are creating a plan with the -target option, which means that the result of this plan may not represent all of the changes requested by the current configuration.
The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.`,
The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when OpenTF specifically suggests to use it as part of an error message.`,
),
// ...but now we have no error about test_object.a
}.ForRPC()
@ -3570,7 +3570,7 @@ output "a" {
t.Errorf("unexpected detail\ngot: %s\nwant to contain %q", got, want)
}
} else if desc.Summary == "Error message refers to sensitive values" {
if got, want := desc.Detail, "The error expression used to explain this condition refers to sensitive values, so Terraform will not display the resulting message."; !strings.Contains(got, want) {
if got, want := desc.Detail, "The error expression used to explain this condition refers to sensitive values, so OpenTF will not display the resulting message."; !strings.Contains(got, want) {
t.Errorf("unexpected detail\ngot: %s\nwant to contain %q", got, want)
}
} else {

View File

@ -222,27 +222,27 @@ resource "implicit_thing" "b" {
tfdiags.Sourceless(
tfdiags.Error,
"Missing required provider",
"This configuration requires built-in provider terraform.io/builtin/nonexist, but that provider isn't available in this Terraform version.",
"This configuration requires built-in provider terraform.io/builtin/nonexist, but that provider isn't available in this OpenTF version.",
),
tfdiags.Sourceless(
tfdiags.Error,
"Missing required provider",
"This configuration requires provider example.com/foo/beep, but that provider isn't available. You may be able to install it automatically by running:\n terraform init",
"This configuration requires provider example.com/foo/beep, but that provider isn't available. You may be able to install it automatically by running:\n opentf init",
),
tfdiags.Sourceless(
tfdiags.Error,
"Missing required provider",
"This configuration requires provider registry.terraform.io/hashicorp/implicit, but that provider isn't available. You may be able to install it automatically by running:\n terraform init",
"This configuration requires provider registry.terraform.io/hashicorp/implicit, but that provider isn't available. You may be able to install it automatically by running:\n opentf init",
),
tfdiags.Sourceless(
tfdiags.Error,
"Missing required provider",
"This configuration requires provider registry.terraform.io/hashicorp/implicit2, but that provider isn't available. You may be able to install it automatically by running:\n terraform init",
"This configuration requires provider registry.terraform.io/hashicorp/implicit2, but that provider isn't available. You may be able to install it automatically by running:\n opentf init",
),
tfdiags.Sourceless(
tfdiags.Error,
"Missing required provisioner plugin",
`This configuration requires provisioner plugin "nonexist", which isn't available. If you're intending to use an external provisioner plugin, you must install it manually into one of the plugin search directories before running Terraform.`,
`This configuration requires provisioner plugin "nonexist", which isn't available. If you're intending to use an external provisioner plugin, you must install it manually into one of the plugin search directories before running OpenTF.`,
),
)
assertDiagnosticsMatch(t, gotDiags, wantDiags)

View File

@ -260,7 +260,7 @@ func evalCheckErrorMessage(expr hcl.Expression, hclCtx *hcl.EvalContext) (string
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Error message refers to sensitive values",
Detail: `The error expression used to explain this condition refers to sensitive values, so Terraform will not display the resulting message.
Detail: `The error expression used to explain this condition refers to sensitive values, so OpenTF will not display the resulting message.
You can correct this by removing references to sensitive values, or by carefully using the nonsensitive() function if the expression will not reveal the sensitive data.`,
Subject: expr.Range().Ptr(),

View File

@ -32,7 +32,7 @@ func evaluateCountExpression(expr hcl.Expression, ctx EvalContext) (int, tfdiags
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Invalid count argument",
Detail: `The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target argument to first apply only the resources that the count depends on.`,
Detail: `The "count" value depends on resource attributes that cannot be determined until apply, so OpenTF cannot predict how many instances will be created. To work around this, use the -target argument to first apply only the resources that the count depends on.`,
Subject: expr.Range().Ptr(),
// TODO: Also populate Expression and EvalContext in here, but

View File

@ -84,8 +84,8 @@ func evaluateForEachExpressionValue(expr hcl.Expression, ctx EvalContext, allowU
}
ty := forEachVal.Type()
const errInvalidUnknownDetailMap = "The \"for_each\" map includes keys derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full set of keys that will identify the instances of this resource.\n\nWhen working with unknown values in for_each, it's better to define the map keys statically in your configuration and place apply-time results only in the map values.\n\nAlternatively, you could use the -target planning option to first apply only the resources that the for_each value depends on, and then apply a second time to fully converge."
const errInvalidUnknownDetailSet = "The \"for_each\" set includes values derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full set of keys that will identify the instances of this resource.\n\nWhen working with unknown values in for_each, it's better to use a map value where the keys are defined statically in your configuration and where only the values contain apply-time results.\n\nAlternatively, you could use the -target planning option to first apply only the resources that the for_each value depends on, and then apply a second time to fully converge."
const errInvalidUnknownDetailMap = "The \"for_each\" map includes keys derived from resource attributes that cannot be determined until apply, and so OpenTF cannot determine the full set of keys that will identify the instances of this resource.\n\nWhen working with unknown values in for_each, it's better to define the map keys statically in your configuration and place apply-time results only in the map values.\n\nAlternatively, you could use the -target planning option to first apply only the resources that the for_each value depends on, and then apply a second time to fully converge."
const errInvalidUnknownDetailSet = "The \"for_each\" set includes values derived from resource attributes that cannot be determined until apply, and so OpenTF cannot determine the full set of keys that will identify the instances of this resource.\n\nWhen working with unknown values in for_each, it's better to use a map value where the keys are defined statically in your configuration and where only the values contain apply-time results.\n\nAlternatively, you could use the -target planning option to first apply only the resources that the for_each value depends on, and then apply a second time to fully converge."
switch {
case forEachVal.IsNull():

View File

@ -37,7 +37,7 @@ func evaluateImportIdExpression(expr hcl.Expression, ctx EvalContext) (string, t
return "", diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Invalid import id argument",
Detail: `The import block "id" argument depends on resource attributes that cannot be determined until apply, so Terraform cannot plan to import this resource.`, // FIXME and what should I do about that?
Detail: `The import block "id" argument depends on resource attributes that cannot be determined until apply, so OpenTF cannot plan to import this resource.`, // FIXME and what should I do about that?
Subject: expr.Range().Ptr(),
// Expression:
// EvalContext:

View File

@ -228,7 +228,7 @@ func evalVariableValidations(addr addrs.AbsInputVariableInstance, config *config
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "No final value for variable",
Detail: fmt.Sprintf("Terraform doesn't have a final value for %s during validation. This is a bug in Terraform; please report it!", addr),
Detail: fmt.Sprintf("OpenTF doesn't have a final value for %s during validation. This is a bug in Terraform; please report it!", addr),
})
return diags
}
@ -302,7 +302,7 @@ func evalVariableValidation(validation *configs.CheckRule, hclCtx *hcl.EvalConte
&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Validation error message expression is invalid",
Detail: fmt.Sprintf("The error message provided could not be evaluated as an expression, so Terraform is interpreting it as a string literal.\n\nIn future versions of Terraform, this will be considered an error. Please file a GitHub issue if this would break your workflow.\n\n%s", errorDiags.Error()),
Detail: fmt.Sprintf("The error message provided could not be evaluated as an expression, so OpenTF is interpreting it as a string literal.\n\nIn future versions of Terraform, this will be considered an error. Please file a GitHub issue if this would break your workflow.\n\n%s", errorDiags.Error()),
Subject: validation.ErrorMessage.Range().Ptr(),
Context: validation.DeclRange.Ptr(),
Expression: validation.ErrorMessage,
@ -378,7 +378,7 @@ func evalVariableValidation(validation *configs.CheckRule, hclCtx *hcl.EvalConte
Severity: hcl.DiagError,
Summary: "Error message refers to sensitive values",
Detail: `The error expression used to explain this condition refers to sensitive values. Terraform will not display the resulting message.
Detail: `The error expression used to explain this condition refers to sensitive values. OpenTF will not display the resulting message.
You can correct this by removing references to sensitive values, or by carefully using the nonsensitive() function if the expression will not reveal the sensitive data.`,

View File

@ -673,7 +673,7 @@ func (d *evaluationStateData) GetResource(addr addrs.Resource, rng tfdiags.Sourc
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: `Missing resource type schema`,
Detail: fmt.Sprintf("No schema is available for %s in %s. This is a bug in Terraform and should be reported.", addr, config.Provider),
Detail: fmt.Sprintf("No schema is available for %s in %s. This is a bug in OpenTF and should be reported.", addr, config.Provider),
Subject: rng.ToHCL().Ptr(),
})
return cty.DynamicVal, diags
@ -999,7 +999,7 @@ func (d *evaluationStateData) GetCheckBlock(addr addrs.Check, rng tfdiags.Source
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Reference to \"check\" in invalid context",
Detail: "The \"check\" object can only be referenced from an \"expect_failures\" attribute within a Terraform testing \"run\" block.",
Detail: "The \"check\" object can only be referenced from an \"expect_failures\" attribute within a OpenTF testing \"run\" block.",
Subject: rng.ToHCL().Ptr(),
})
return cty.NilVal, diags

View File

@ -271,7 +271,7 @@ func (d *evaluationStateData) staticValidateResourceReference(modCfg *configs.Co
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: `Invalid resource count attribute`,
Detail: fmt.Sprintf(`The special "count" attribute is no longer supported after Terraform v0.12. Instead, use length(%s) to count resource instances.`, addr),
Detail: fmt.Sprintf(`The special "count" attribute is no longer supported after OpenTF v0.12. Instead, use length(%s) to count resource instances.`, addr),
Subject: rng.ToHCL().Ptr(),
})
return diags

View File

@ -362,7 +362,7 @@ func (n *NodeApplyableOutput) Execute(ctx EvalContext, op walkOperation) (diags
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Output refers to sensitive values",
Detail: `To reduce the risk of accidentally exporting sensitive data that was intended to be only internal, Terraform requires that any root module output containing sensitive data be explicitly marked as sensitive, to confirm your intent.
Detail: `To reduce the risk of accidentally exporting sensitive data that was intended to be only internal, OpenTF requires that any root module output containing sensitive data be explicitly marked as sensitive, to confirm your intent.
If you do intend to export this data, annotate the output value as sensitive by adding the following argument:
sensitive = true`,

View File

@ -442,7 +442,7 @@ func (n *NodeAbstractResource) readResourceInstanceState(ctx EvalContext, addr a
schema, currentVersion := (providerSchema).SchemaForResourceAddr(addr.Resource.ContainingResource())
if schema == nil {
// Shouldn't happen since we should've failed long ago if no schema is present
return nil, diags.Append(fmt.Errorf("no schema available for %s while reading state; this is a bug in Terraform and should be reported", addr))
return nil, diags.Append(fmt.Errorf("no schema available for %s while reading state; this is a bug in OpenTF and should be reported", addr))
}
src, upgradeDiags := upgradeResourceState(addr, provider, src, schema, currentVersion)
if n.Config != nil {
@ -472,7 +472,7 @@ func (n *NodeAbstractResource) readResourceInstanceStateDeposed(ctx EvalContext,
}
if key == states.NotDeposed {
return nil, diags.Append(fmt.Errorf("readResourceInstanceStateDeposed used with no instance key; this is a bug in Terraform and should be reported"))
return nil, diags.Append(fmt.Errorf("readResourceInstanceStateDeposed used with no instance key; this is a bug in OpenTF and should be reported"))
}
log.Printf("[TRACE] readResourceInstanceStateDeposed: reading state for %s deposed object %s", addr, key)
@ -487,7 +487,7 @@ func (n *NodeAbstractResource) readResourceInstanceStateDeposed(ctx EvalContext,
schema, currentVersion := (providerSchema).SchemaForResourceAddr(addr.Resource.ContainingResource())
if schema == nil {
// Shouldn't happen since we should've failed long ago if no schema is present
return nil, diags.Append(fmt.Errorf("no schema available for %s while reading state; this is a bug in Terraform and should be reported", addr))
return nil, diags.Append(fmt.Errorf("no schema available for %s while reading state; this is a bug in OpenTF and should be reported", addr))
}

View File

@ -675,7 +675,7 @@ func (n *NodeAbstractResourceInstance) plan(
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Resource has no configuration",
fmt.Sprintf("Terraform attempted to process a resource at %s that has no configuration. This is a bug in Terraform; please report it!", n.Addr.String())))
fmt.Sprintf("OpenTF attempted to process a resource at %s that has no configuration. This is a bug in Terraform; please report it!", n.Addr.String())))
return nil, nil, keyData, diags
}
@ -2351,7 +2351,7 @@ func (n *NodeAbstractResourceInstance) apply(
tfdiags.Error,
"Provider produced invalid object",
fmt.Sprintf(
"Provider %q produced an invalid value after apply for %s. The result cannot not be saved in the Terraform state.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
"Provider %q produced an invalid value after apply for %s. The result cannot not be saved in the OpenTF state.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
n.ResolvedProvider.String(), tfdiags.FormatErrorPrefixed(err, n.Addr.String()),
),
))
@ -2387,7 +2387,7 @@ func (n *NodeAbstractResourceInstance) apply(
tfdiags.Error,
"Provider returned invalid result object after apply",
fmt.Sprintf(
"After the apply operation, the provider still indicated an unknown value for %s%s. All values must be known after apply, so this is always a bug in the provider and should be reported in the provider's own repository. Terraform will still save the other known object values in the state.",
"After the apply operation, the provider still indicated an unknown value for %s%s. All values must be known after apply, so this is always a bug in the provider and should be reported in the provider's own repository. OpenTF will still save the other known object values in the state.",
n.Addr, pathStr,
),
))
@ -2460,7 +2460,7 @@ func (n *NodeAbstractResourceInstance) apply(
tfdiags.Error,
"Provider returned invalid result object after apply",
fmt.Sprintf(
"After applying a %s plan, the provider returned a non-null object for %s. Destroying should always produce a null value, so this is always a bug in the provider and should be reported in the provider's own repository. Terraform will still save this errant object in the state for debugging and recovery.",
"After applying a %s plan, the provider returned a non-null object for %s. Destroying should always produce a null value, so this is always a bug in the provider and should be reported in the provider's own repository. OpenTF will still save this errant object in the state for debugging and recovery.",
change.Action, n.Addr,
),
))

View File

@ -350,7 +350,7 @@ func (n *NodeApplyableResourceInstance) managedResourceExecute(ctx EvalContext)
tfdiags.Error,
"Attempt to restore non-existent deposed object",
fmt.Sprintf(
"Terraform has encountered a bug where it would need to restore a deposed object for %s without knowing a deposed object key for that object. This occurred during a %s action. This is a bug in Terraform; please report it!",
"OpenTF has encountered a bug where it would need to restore a deposed object for %s without knowing a deposed object key for that object. This occurred during a %s action. This is a bug in Terraform; please report it!",
addr, diffApply.Action,
),
))
@ -359,7 +359,7 @@ func (n *NodeApplyableResourceInstance) managedResourceExecute(ctx EvalContext)
tfdiags.Error,
"Attempt to restore non-existent deposed object",
fmt.Sprintf(
"Terraform has encountered a bug where it would need to restore a deposed object for %s without knowing a deposed object key for that object. This is a bug in Terraform; please report it!",
"OpenTF has encountered a bug where it would need to restore a deposed object for %s without knowing a deposed object key for that object. This is a bug in Terraform; please report it!",
addr,
),
))
@ -429,9 +429,9 @@ func (n *NodeApplyableResourceInstance) checkPlannedChange(ctx EvalContext, plan
// If the order of replacement changed, then that is a bug in terraform
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Terraform produced inconsistent final plan",
"OpenTF produced inconsistent final plan",
fmt.Sprintf(
"When expanding the plan for %s to include new values learned so far during apply, the planned action changed from %s to %s.\n\nThis is a bug in Terraform and should be reported.",
"When expanding the plan for %s to include new values learned so far during apply, the planned action changed from %s to %s.\n\nThis is a bug in OpenTF and should be reported.",
absAddr, plannedChange.Action, actualChange.Action,
),
))

View File

@ -300,7 +300,7 @@ func (n *NodeDestroyDeposedResourceInstanceObject) writeResourceInstanceState(ct
if key == states.NotDeposed {
// should never happen
return fmt.Errorf("can't save deposed object for %s without a deposed key; this is a bug in Terraform that should be reported", absAddr)
return fmt.Errorf("can't save deposed object for %s without a deposed key; this is a bug in OpenTF that should be reported", absAddr)
}
if obj == nil {

View File

@ -157,7 +157,7 @@ func (n *graphNodeImportState) DynamicExpand(ctx EvalContext) (*Graph, error) {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Resource already managed by Terraform",
fmt.Sprintf("Terraform is already managing a remote object for %s. To import to this address you must first remove the existing object from the state.", addr),
fmt.Sprintf("OpenTF is already managing a remote object for %s. To import to this address you must first remove the existing object from the state.", addr),
))
continue
}
@ -241,7 +241,7 @@ func (n *graphNodeImportStateSub) Execute(ctx EvalContext, op walkOperation) (di
"the provider detected that no object exists with the given id. "+
"Only pre-existing objects can be imported; check that the id "+
"is correct and that it is associated with the provider's "+
"configured region or endpoint, or use \"terraform apply\" to "+
"configured region or endpoint, or use \"opentf apply\" to "+
"create a new remote object for this resource.",
n.TargetAddr,
),

View File

@ -546,7 +546,7 @@ func (n *NodePlannableResourceInstance) importState(ctx EvalContext, addr addrs.
"the provider detected that no object exists with the given id. "+
"Only pre-existing objects can be imported; check that the id "+
"is correct and that it is associated with the provider's "+
"configured region or endpoint, or use \"terraform apply\" to "+
"configured region or endpoint, or use \"opentf apply\" to "+
"create a new remote object for this resource.",
n.importTarget.Addr,
),

View File

@ -400,7 +400,7 @@ func (n *NodeValidatableResource) validateResource(ctx EvalContext) tfdiags.Diag
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Redundant ignore_changes element",
Detail: fmt.Sprintf("Adding an attribute name to ignore_changes tells Terraform to ignore future changes to the argument in configuration after the object has been created, retaining the value originally configured.\n\nThe attribute %s is decided by the provider alone and therefore there can be no configured value to compare with. Including this attribute in ignore_changes has no effect. Remove the attribute from ignore_changes to quiet this warning.", attrDisplayPath),
Detail: fmt.Sprintf("Adding an attribute name to ignore_changes tells OpenTF to ignore future changes to the argument in configuration after the object has been created, retaining the value originally configured.\n\nThe attribute %s is decided by the provider alone and therefore there can be no configured value to compare with. Including this attribute in ignore_changes has no effect. Remove the attribute from ignore_changes to quiet this warning.", attrDisplayPath),
Subject: &n.Config.TypeRange,
})
}

View File

@ -630,7 +630,7 @@ func TestNodeValidatableResource_ValidateResource_invalidIgnoreChangesComputed(t
if diags.HasErrors() {
t.Fatalf("got unexpected error: %s", diags.ErrWithWarnings())
}
if got, want := diags.ErrWithWarnings().Error(), `Redundant ignore_changes element: Adding an attribute name to ignore_changes tells Terraform to ignore future changes to the argument in configuration after the object has been created, retaining the value originally configured.
if got, want := diags.ErrWithWarnings().Error(), `Redundant ignore_changes element: Adding an attribute name to ignore_changes tells OpenTF to ignore future changes to the argument in configuration after the object has been created, retaining the value originally configured.
The attribute computed_string is decided by the provider alone and therefore there can be no configured value to compare with. Including this attribute in ignore_changes has no effect. Remove the attribute from ignore_changes to quiet this warning.`; !strings.Contains(got, want) {
t.Fatalf("wrong error\ngot: %s\nwant: Message containing %q", got, want)

View File

@ -37,7 +37,7 @@ func validateSelfRef(addr addrs.Referenceable, config hcl.Body, providerSchema p
}
if schema == nil {
diags = diags.Append(fmt.Errorf("no schema available for %s to validate for self-references; this is a bug in Terraform and should be reported", addr))
diags = diags.Append(fmt.Errorf("no schema available for %s to validate for self-references; this is a bug in OpenTF and should be reported", addr))
return diags
}