resource "google_service_account" "myaccount" {
account_id = "dev-foo-account"
}
resource "google_service_account_key" "mykey" {
service_account_id = google_service_account.myaccount.name
}
data "google_service_account_key" "mykey" {
name = google_service_account_key.mykey.name
public_key_type = "TYPE_X509_PEM_FILE"
}
如果我创建一个服务帐户和这样的密钥-我如何获得密钥之后?
terraform output
yields:
$ terraform output -json google_service_account_key
The output variable requested could not be found in the state
file. If you recently added this to your configuration, be
sure to run `terraform apply`, since the state won't be updated
with new output variables until that command is run.
如果要在应用计划后使用该变量,则必须将该变量作为输出:
output "my_private_key" {
value = data.google_service_account_key.mykey.private_key
}
输出“my_private_key”的值:
$ terraform output my_private_key
要以 JSON 形式获取凭据,稍后可用于身份验证:
$ terraform output -raw key | base64 -d -
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(2条)