地形|从Cloud SQL检索(客户端密钥)证书 [英] Terraform | Retrieve the (client-key) certificate from Cloud SQL
问题描述
我想通过Terraform检索cloudsql的客户端密钥SSL密钥,我能够通过terraform检索server-ca和客户端证书,但不知道如何获取客户端密钥文件.要检索客户端证书,我已经使用了以下要点:请看.
I would like to retrieve the client-key SSL key of cloudsql via Terraform, I was able to retrieve the server-ca and the client-cert via terraform but have no idea how to get the client-key file. TO retrieve the client-cert I have used the below mentioned point: Please look.
resource "google_sql_ssl_cert" "client_cert" {
depends_on = ["google_sql_database_instance.new_instance_sql_master",
"google_sql_user.users"]
common_name = "terraform1"
project = "${var.project_id}"
instance ="${google_sql_database_instance.new_instance_sql_master.name}"
}
Output.tf
Output.tf
output "client_cert" {
value = "${google_sql_ssl_cert.client_cert.0.cert}"
description = "The CA Certificate used to connect to the SQL Instance via
SSL"
}
请让我知道如何检索客户端密钥私钥.即server-ca,client-cert和我需要通过Terraform的client-key.
Please let me know how can I retrieve the client-key private key. i.e server-ca, client-cert and I need client-key via terraform.
推荐答案
为了获取客户端私钥,请将以下代码段与您希望拥有的任何其他参数一起使用:
In order to get the client private key, use the following snippet with any other parameters you wish to have:
output "client_privkey" {
value = "${google_sql_ssl_cert.client_cert.*.private_key}"
}
对于客户证书:value = "${google_sql_ssl_cert.client_cert.*.cert}"
对于服务器证书:value = ${google_sql_ssl_cert.client_cert.*.server_ca_cert}"
这篇关于地形|从Cloud SQL检索(客户端密钥)证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!