运行地形计划时发生地形崩溃错误



我正在运行地形版本0.12.24,在计划中我得到以下错误:

Configuring remote state backend...
Initializing Terraform configuration...
2020/12/08 02:35:21 [DEBUG] Using modified User-Agent: Terraform/0.12.24 TFC/ed5bcca736
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xdb92be]
goroutine 37 [running]:
github.com/hashicorp/terraform/lang/blocktoattr.walkVariables(0x236eac0, 0xc0016e2420, 0x0, 0xc0000b2001, 0x236eac0, 0xc0016e2420, 0x0, 0x0, 0x0, 0x74)
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/lang/blocktoattr/variables.go:34 +0x1ae
github.com/hashicorp/terraform/lang/blocktoattr.ExpandedVariables(...)
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/lang/blocktoattr/variables.go:24
github.com/hashicorp/terraform/lang.ReferencesInBlock(0x236eac0, 0xc0016e2420, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc002bb3230)
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/lang/references.go:68 +0x66
github.com/hashicorp/terraform/terraform.(*NodeAbstractResource).References(0xc001c41ba0, 0x0, 0x0, 0x0)
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/terraform/node_resource_abstract.go:195 +0x33d
github.com/hashicorp/terraform/terraform.NewReferenceMap(0xc002260000, 0x86e, 0x86e, 0x86e)
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/terraform/transform_reference.go:492 +0x24a
github.com/hashicorp/terraform/terraform.(*ReferenceTransformer).Transform(0x3523918, 0xc001274730, 0x14, 0x0)
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/terraform/transform_reference.go:79 +0x71
github.com/hashicorp/terraform/terraform.(*BasicGraphBuilder).Build(0xc001ddb8e8, 0x0, 0x0, 0x0, 0x3503c40, 0xc002653918, 0x4e57b0, 0xc0000b2000)
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/terraform/graph_builder.go:50 +0x477
github.com/hashicorp/terraform/terraform.(*PlanGraphBuilder).Build(0xc000359c70, 0x0, 0x0, 0x0, 0x1, 0x1f31e00, 0xc00171d701, 0xc002653978)
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/terraform/graph_builder_plan.go:65 +0xbc
github.com/hashicorp/terraform/terraform.(*Context).Graph(0xc001be22d0, 0x6, 0xc00265396e, 0xc002be2200, 0x47, 0x14, 0xbfebd77acf8e1043)
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/terraform/context.go:292 +0x1b8
github.com/hashicorp/terraform/terraform.(*Context).Validate(0xc001be22d0, 0x0, 0x0, 0x0)
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/terraform/context.go:675 +0xc9
github.com/hashicorp/terraform/backend/local.(*Local).context(0xc00043a1a0, 0xc0004d6c40, 0x1, 0x1, 0x2, 0xc0006d4180, 0x1, 0x2, 0x0)
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/backend/local/backend_local.go:120 +0x974
github.com/hashicorp/terraform/backend/local.(*Local).opPlan(0xc00043a1a0, 0x236e140, 0xc00063a900, 0x236e140, 0xc00063a940, 0xc0004d6c40, 0xc00063a8c0)
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/backend/local/backend_plan.go:70 +0x2a3
github.com/hashicorp/terraform/backend/local.(*Local).Operation.func1(0xc0006bbb00, 0xc0006bbb10, 0xc0006bbb30, 0xc0004d6c40, 0xc00043a1a0, 0xc00063a8c0, 0xc0006bbae0, 0x236e140, 0xc00063a900, 0x236e140, ...)
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/backend/local/backend.go:350 +0x135
created by github.com/hashicorp/terraform/backend/local.(*Local).Operation
/opt/teamcity-agent/work/9e329aa031982669/src/github.com/hashicorp/terraform/backend/local/backend.go:334 +0x36b

我在tf中对这些资源进行了以下更改

  • aws_db_proxy_target
  • aws_db_proxy_default_target_group
  • aws_db_proxy

当我将aws提供程序切换到3.20.0时,故障不再发生。然而,回购剩余部分的版本需要2.x.

我尝试使用多个提供商:

provider "aws" {
version = "~> 2.60.0"
region  = "us-west-2"
}
provider "aws" {
version = "~> 3.20.0"
region  = "us-west-2"
alias   = "version_3"
}

module "my-module" 
...
...
providers = {
aws = aws.version_3
}
}

但是运行terraform init返回:

No provider "aws" plugins meet the constraint " < 4.0, < 4.0,>= 2.0,>= 2.0,>= 2.25,>= 2.42,>= 2.42,>= 2.49,>= 2.49,>= 2.49,>= 2.49,>= 2.49,~> 2.0,~> 2.0,~> 2.0,~> 2.0,~> 2.0,~> 2.0,~> 2.0,~> 2.0,~> 2.0,~> 2.60.0,~> 3.20.0".
The version constraint is derived from the "version" argument within the
provider "aws" block in configuration. Child modules may also apply
provider version constraints. To view the provider versions requested by each
module in the current configuration, run "terraform providers".
To proceed, the version constraints for this provider must be relaxed by
either adjusting or removing the "version" argument in the provider blocks
throughout the configuration.
- Downloading plugin for provider "template" (hashicorp/template) 2.2.0...
Error: no suitable version is available

我以前在多个提供程序中遇到过这个问题。最后,我在模块内部嵌入了第二个带有别名的提供程序块,它就工作了。显然,我建议您将该模块中的任何敏感值或更改值作为变量传递。

这不是最优雅的方式,但它为我完成了任务。希望你也能做到。

祝你好运!

相关内容

  • 没有找到相关文章

最新更新