terraform - aws_kms_ciphertext输出能稳定吗

标签 terraform aws-kms

在我的 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/

相关文章:

azure - Terraform Plan 在 Windows 上为列表变量传递值

amazon-web-services - 如何使用 terraform 运行 ECS 任务?

amazon-web-services - AWS Secrets Manager 控制台上的 "Failed to fetch a list of secrets"?

amazon-web-services - AWS 错误消息 : Requests specifying Server Side Encryption with AWS KMS managed keys require AWS Signature Version 4

ios - 没有开发工具包的 AWS Rest API

amazon-web-services - 使用 terraform 为多个现有 s3 存储桶创建 s3 存储桶策略

amazon-web-services - 多个工作区上的 Terraform 单一资源

azure - Terraform:使用 azurerm_kubernetes_cluster 创建 AKS 群集时指定网络安全组规则

aws-powershell - 如何在 AWS Powershell 脚本中使用 KMS key 加密数据

amazon-web-services - 如何为S3事件编写加密的SQS的策略声明?