当我执行时,terraform init
我有以下输出:
Initializing modules...
- compute in modules\compute
- private_network in modules\private_network
- public_ip in modules\public_ip
- route in modules\route
Initializing the backend...
Initializing provider plugins...
- Finding terraform-provider-openstack/openstack versions matching "~> 1.35.0"...
- Finding latest version of hashicorp/openstack...
- Installing terraform-provider-openstack/openstack v1.35.0...
- Installed terraform-provider-openstack/openstack v1.35.0 (self-signed, key ID 4F80527A391BEFD2)
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/plugins/signing.html
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider
hashicorp/openstack: provider registry registry.terraform.io does not have a
provider named registry.terraform.io/hashicorp/openstack
这是我的 provider.tf 文件(灵感来自于 Terraform 的官方文档):
# Define required providers
terraform {
required_version = ">= 0.14.0"
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "~> 1.35.0"
}
}
}
# Configure the OpenStack Provider
provider "openstack" {
user_name = "username"
tenant_name = "tenantname"
password = "mypasswd"
auth_url = "http://my.openstack.lan:5000"
region = "RegionOne"
}
# Create a web server
#resource "openstack_compute_instance_v2" "test-server" {
# ...
#}
当我检查版本时,我有这个:
Terraform v0.14.2
Your version of Terraform is out of date! The latest version
is 1.0.3. You can update by downloading from https://www.terraform.io/downloads.html
这是我跑步的时候terraform apply
Error: Could not load plugin
Plugin reinitialization required. Please run "terraform init".
Plugins are external binaries that Terraform uses to access and manipulate
don't satisfy the version constraints, or are otherwise incompatible.
Terraform automatically discovers provider requirements from your
configuration, including providers used in child modules. To see the
requirements and constraints, run "terraform providers".
2 problems:
- Failed to instantiate provider "registry.terraform.io/hashicorp/openstack"
to obtain schema: unknown provider "registry.terraform.io/hashicorp/openstack"
- Failed to instantiate provider
"registry.terraform.io/terraform-provider-openstack/openstack" to obtain
schema: unknown provider
最后terraform providers
Providers required by configuration:
.
├── provider[registry.terraform.io/terraform-provider-openstack/openstack] ~> 1.35.0
├── module.compute
│ └── provider[registry.terraform.io/hashicorp/openstack]
├── module.private_network
│ └── provider[registry.terraform.io/hashicorp/openstack]
├── module.public_ip
│ └── provider[registry.terraform.io/hashicorp/openstack]
└── module.route
└── provider[registry.terraform.io/hashicorp/openstack]