我运行此命令来更新 ubuntu VM 中的软件包。
sudo apt-get update
Run Code Online (Sandbox Code Playgroud)
它最后给了我以下错误。
Err:5 https://apt.releases.hashicorp.com bionic InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY XXXXXXXXXXXXXXXX
Fetched 12.0 kB in 1s (10.4 kB/s)
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://apt.releases.hashicorp.com bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY XXXXXXXXXXXXXXXX
W: …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用远程后端在 GCP 上创建新资源\n执行 terraform init plan -out=tfplan 然后 terraform apply tfplan 后,出现以下错误:
\nError: Inconsistent dependency lock file\n\xe2\x94\x82 \n\xe2\x94\x82 The following dependency selections recorded in the lock file are\n\xe2\x94\x82 inconsistent with the configuration in the saved plan:\n\xe2\x94\x82 Terraform 0.13 and earlier allowed provider version constraints inside the\n\xe2\x94\x82 provider configuration block, but that is now deprecated and will be\n\xe2\x94\x82 removed in a future version of Terraform. To silence this warning, move the\n\xe2\x94\x82 provider version constraint into the required_providers block.\n\xe2\x94\x82 \n\xe2\x94\x82 (and …
Run Code Online (Sandbox Code Playgroud) 首先,如果有人已经提出了这个问题,我很抱歉,在这种情况下,请将链接粘贴到此处,因为我没有找到任何内容。我正在学习 vagrant,使用 virtualbox 我在运行虚拟机时没有问题,但如果我想使用 VMware 作为提供程序。我遇到此消息,但找不到摆脱此问题的方法。我认为一切都配置良好,但显然有些问题。
当我启动时vagrant up --provider=vmware_desktop
,我收到以下错误消息:
Vagrant encountered an unexpected communications error with the
Vagrant VMware Utility driver. Please try to run the command
again. If this error persists, please contact support@hashicorp.com
Run Code Online (Sandbox Code Playgroud)
我目前使用的是 Fedora 35
Operating System: Fedora Linux 35 (Workstation Edition)
Kernel: Linux 5.17.5-200.fc35.x86_64
Architecture: x86-64
Run Code Online (Sandbox Code Playgroud) 我正在使用 terraform 版本 0.13.2,提供商http://registry.terraform.io/hashicorp/local v2.1.0 并拥有以下资源:
\nterraform {\n required_providers {\n local = {\n source = "hashicorp/local"\n }\n }\n required_version = ">= 0.13"\n}\n\nresource "local_file" "test_local_file" {\n content = "This is a test file"\n filename = "test.txt"\n}\n
Run Code Online (Sandbox Code Playgroud)\n现在,当我仅获取另一个目录中的 terraform.tfstate 文件并尝试在新目录中使用 terraform 1.1.2 销毁此配置时,我在 terraform destroy 上收到以下错误:
\n\xe2\x94\x82 Error: Missing resource schema from provider\n\xe2\x94\x82 \n\xe2\x94\x82 No resource schema found for local_file.\n
Run Code Online (Sandbox Code Playgroud)\n解决办法是什么?
\n我正在使用 GitHub Actions 和 Terraform 构建 CI/CD 管道。我有一个如下所示的 main.tf 文件,我从多个环境的 GitHub 操作中调用该文件。我正在使用https://github.com/hashicorp/setup-terraform与 GitHub 操作中的 Terraform 进行交互。我有 MyService 组件,并且正在部署到 DEV、UAT 和 PROD 环境。我想在所有环境中重用 main.tf 并动态设置工作区名称,如下所示:MyService-DEV、MyService-UAT、MyService-PROD。terraform/cloud 块中不允许使用变量。我正在使用 HashiCorp 云来存储状态。
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.0"
}
}
cloud {
organization = "tf-organization"
workspaces {
name = "MyService-${env.envname}" #<==not allowed to use variables
}
}
}
Run Code Online (Sandbox Code Playgroud)
更新
我终于成功地启动并运行了这个程序并提供了有用的评论。以下是我的发现:
您好,我正在尝试计划地形更新。我们正在使用一个由许多模块组成的复杂的 terraform 项目。
我添加了一个需要hashicorp/null
版本 ~> 3.1.0 的 CloudSQL 数据库模块,但我项目中的另一个模块似乎对hashicorp/null
版本 ~> 2.1 有依赖约束。
导致出现以下错误:
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider hashicorp/null:
no available releases match the given constraints ~> 2.1, ~> 3.1.0
Run Code Online (Sandbox Code Playgroud)
如何跟踪和更新此依赖性约束?我不知道我的项目的哪一部分正在执行它?
安装的 terraform 和 init 失败。
\n- Finding hashicorp/aws versions matching "~> 4.16"...\n\xe2\x95\xb7\n\xe2\x94\x82 Error: Failed to query available provider packages\n\xe2\x94\x82 \n\xe2\x94\x82 Could not retrieve the list of available versions for provider hashicorp/aws: could not connect to registry.terraform.io: Failed to request discovery document: Get\n\xe2\x94\x82 "https://registry.terraform.io/.well-known/terraform.json": x509: \xe2\x80\x9ccf-registry.tf-registry-prod-use1.terraform.io\xe2\x80\x9d certificate is not standards compliant\n
Run Code Online (Sandbox Code Playgroud)\nterraform {\n required_providers {\n aws = {\n source = "hashicorp/aws"\n version = "~> 4.16"\n }\n }\n\n required_version = ">= 1.2.0"\n}\n\nprovider "aws" {\n region = "us-west-2"\n}\n\nresource "aws_instance" "app_server" {\n …
Run Code Online (Sandbox Code Playgroud) 我是 Terraform 的新手,正在学习有关如何创建 aws_elasticip 模块的教程。当我执行“terraform plan”时,出现此问题,并且我无法继续创建 terraform 文件。
\n terraform {\n required_providers {\n aws = {\n source = "hashicorp/aws"\n version = "~> 4.16"\n }\n }\n}\n\nprovider "aws" {\n region = "eu-west-2"\n}\n\nresource "aws_eip" "lb" {\n domain = "vpc"\n}\n
Run Code Online (Sandbox Code Playgroud)\n我还尝试使用声明的实例变量来执行此操作,但错误仍然存在
\nterraform {\n required_providers {\n aws = {\n source = "hashicorp/aws"\n version = "~> 4.16"\n }\n }\n}\n\nprovider "aws" {\n region = "eu-west-2"\n}\n\nresource "aws_vpc" "vpc_a" {\n cidr_block = "10.0.0.0/16"\n}\n\nresource "aws_instance" "server_a" {\n ami = "ami-06464c878dbe46da4"\n instance_type = "t2.micro"\n}\n\nresource "aws_eip" "lb" {\n instance = …
Run Code Online (Sandbox Code Playgroud) 我的provider.tf 文件中已经有最新版本:
required_providers {
archive = {
source = "hashicorp/archive"
version = "2.2.0"
}
aws = {
source = "hashicorp/aws"
version = "3.72.0"
}
}
Run Code Online (Sandbox Code Playgroud)
然而,当我检查terraform version
我的终端时,我得到了这个:
Terraform v1.0.7
on darwin_amd64
+ provider registry.terraform.io/hashicorp/archive v2.2.0
+ provider registry.terraform.io/hashicorp/aws v3.72.0
Your version of Terraform is out of date! The latest version
is 1.1.4. You can update by downloading from https://www.terraform.io/downloads.html
Run Code Online (Sandbox Code Playgroud)
我已经尝试过terraform init -upgrade
,但这也没有什么区别。我还从网站手动下载了 terraform 的新版本,但我的终端仍然显示 1.0.7。
由于旧的 Terraform 版本,我面临其他错误。如何使用终端更新到最新版本?