部署KMS密钥
应用场景
相关资源/数据源
资源
操作步骤
1. 脚本准备
2. 创建KMS密钥资源
variable "key_name" {
description = "The alias name of the KMS key"
type = string
}
variable "key_algorithm" {
description = "The generation algorithm of the KMS key"
type = string
default = "AES_256"
}
variable "key_usage" {
description = "The usage of the KMS key"
type = string
default = "ENCRYPT_DECRYPT"
}
variable "key_source" {
description = "The source of the KMS key"
type = string
default = "kms"
}
variable "key_description" {
description = "The description of the KMS key"
type = string
default = ""
}
variable "enterprise_project_id" {
description = "The ID of the enterprise project to which the KMS key belongs"
type = string
default = null
}
variable "key_tags" {
description = "The key/value pairs to associate with the KMS key"
type = map(string)
default = {}
}
variable "key_schedule_time" {
description = "The number of days after which the KMS key is scheduled to be deleted"
type = string
default = "7"
}
# 在指定region(region参数缺省时默认继承当前provider块中所指定的region)下创建KMS密钥资源
resource "huaweicloud_kms_key" "test" {
key_alias = var.key_name
key_algorithm = var.key_algorithm
key_usage = var.key_usage
origin = var.key_source
key_description = var.key_description
enterprise_project_id = var.enterprise_project_id
tags = var.key_tags
pending_days = var.key_schedule_time
}3. 预设资源部署所需的入参(可选)
4. 初始化并应用Terraform配置
参考信息
Last updated