terraform - 如何使用 Terraform 连接到 OCI?
问题描述
我正在使用来自https://github.com/terraform-providers/terraform-provider-oci的 Terraform OCI 提供程序连接到 OCI 的乐趣和游戏
我失败的连接地形是:
provider "oci" {
tenancy_ocid = var.tenancy_ocid
user_ocid = var.user_ocid
fingerprint = var.fingerprint
private_key_path = var.private_key_path
private_key_password = var.private_key_password
region = var.region
}
在我的 var.tf 中引用了一个相应的 pem 文件:
variable "private_key_path" {
type = string
default = "~/.oci/oci_api_key.pem"
}
我得到的错误是:
Error: can not create client, bad configuration: did not find a proper configuration for private key
我正在按照此设置正确的凭据:https ://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm
我该如何解决这个问题?
感谢 John Hanley,我将我的 var.tf 修改为以下内容!请注意从 更改~/.oci
为完整路径/Users/jnevill/.oci
。这是在 Macos 上使用 brew 安装的 terraform。
variable "private_key_path" {
type = string
default = "/Users/jnevill/.oci/oci_api_key.pem"
}
解决方案
谢天谢地,这是一个简单的解决方案 - 感谢 John Hanley 为我指明了正确的方向。简而言之,~
在 private_key_path 变量中不起作用。
解决方案
将 pem 引用从更改~
为/Users/YourUserName/
这使 terraform 能够正确引用 pem 文件。
失败的变量
variable "private_key_path" {
type = string
default = "~/.oci/oci_api_key.pem"
}
工作变量
variable "private_key_path" {
type = string
default = "/Users/jnevill/.oci/oci_api_key.pem"
}
推荐阅读
- laravel - 调度程序未运行 Laravel 5
- pandas - 从文件名导入多个 csv 时创建日期索引
- javascript - 如何在 JavaScript 中检查表格的单元格索引
- redux - 使用 react redux 恢复 Ag Grid 的列状态
- typescript - TypeScript 在函数中自动捕获数组类型变量
- heroku - Heroku 如何使用 AWS S3 凭证访问我存储桶中的图像?
- python - Python PIP 抛出错误 - ImportError: cannot import name main
- msdeploy - MSdeploy 仅适用于根目录的跳过规则
- python - 使用线程类时 Tkinter 应用程序冻结
- ruby-on-rails - Rails:路径字符串在视图中自动更改