我有一个具有三级调用的根模块:
module.this
module.kms
module.kms_init
在根模块调用中,我引用 module.kms_init 的 kms_key_id 或 kms_key_arn 输出。
我在第二级中有该模块的以下输出:
output "key_arn" {
description = "The Amazon Resource Name (ARN) of the key"
value = try(module.kms[*].*)
}
output "key_id" {
description = "The globally unique identifier for the key"
value = try(module.kms[*].*)
}
第一级是 Terraform AWS 模块,具有以下输出:
output "key_arn" {
description = "The Amazon Resource Name (ARN) of the key"
value = try(aws_kms_key.this[0].arn,aws_kms_external_key.this[0].arn, aws_kms_replica_key.this[0].arn, aws_kms_replica_external_key.this[0].arn, null)
}
output "key_id" {
description = "The globally unique identifier for the key"
value = try(aws_kms_key.this[0].key_id, aws_kms_external_key.this[0].id, aws_kms_replica_key.this[0].key_id, aws_kms_replica_external_key.this[0].key_id, null)
}
对此模块和输出的引用如下:
kms_master_key_id = module.kms_init.key _id
它给了我这个错误:
The given value is not suitable for module.bucket_init.var.kms_master_key_id declared at .terraform\modules\bucket_init\variables.tf:588,1-29: string required,
你能帮我吗?
我正在尝试将 kms 密钥 arn 值传递到 s3 存储桶进行加密。
您能否在
try
函数中扭曲 tostring
函数吗?返回的错误表明该值必须是字符串。