在我的 terraform 配置中,我有 aws_kms_ciphertext
数据源,其 ciphertext_blob
属性在每个 terraform apply
上都会发生变化。
举个例子...
variable "profile" {
type = "string"
}
provider "aws" {
region = "us-west-2"
profile = "${var.profile}"
}
resource aws_kms_key "test_key" {
description = "terraform test"
is_enabled = true
}
data aws_kms_ciphertext "test_ciphertext" {
key_id = "${aws_kms_key.test_key.key_id}"
plaintext = "plaintext"
}
output "ciphertext" {
value = "${data.aws_kms_ciphertext.test_ciphertext.ciphertext_blob}"
}
如果你terraform apply
上面的配置每次输出的密文都是不同的。有没有可能把密文稳定下来,或者把它保存在状态文件中,这样即使明文没有改变,也不需要每次都应用?
最佳答案
这是 KMS 加密的正常行为 - 每个具有恒定明文的请求每次都会产生不同的密文。
不可能改变(使密文“稳定”)这种行为,所以加密一次并保留它。
关于terraform - aws_kms_ciphertext输出能稳定吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49755025/