gpt4 book ai didi

terraform - 如何在 terraform 中加密密码或敏感数据?

转载 作者:行者123 更新时间:2023-12-04 01:58:39 27 4
gpt4 key购买 nike

我想为其 in aws 创建 rds 实例和整个所需的基础设施。我无法理解 Terraform 的安全部分。我想至少加密 .tfstate 中的敏感数据。例如:rds 实例的密码/用户名等。存储 .tfstate 敏感数据的最佳方式是什么?如果不支持那么请建议其他方法来做到这一点?谢谢。

最佳答案

使用 AWS 提供商作为示例。

建议将.tfstate文件保存到s3 bucket中,并在上面设置策略,只有提名角色才有权限访问这个bucket和相关的kms key。

terraform {
required_version = "~> 0.10"

backend "s3" {
bucket = "<global_unique_bucket_name>"
key = "development/vpc.tfstate"
region = "ap-southeast-2"
kms_key_id = "alias/terraform"
encrypt = true
}
}

始终在该 s3 存储桶上启用版本控制

关于terraform - 如何在 terraform 中加密密码或敏感数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48892068/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com