I am new to terraform and trying to take advantage of the code in the below github my question is on the variables.tf at this link on line 89-96. See example below for the code snipit. I am trying to figure out how to populate this variable with my KMS key arn and the required resources. The intent is to encrypt the eks cluster with the KMS key
variable “cluster_encryption_config” {
description = “Configuration block with encryption configuration for the cluster”
type = list(object({
provider_key_arn = string
resources = list(string)
}))
default =
}
I’d read this variable type as “a list of objects which have two attributes: a provider_key_arn
string, and a list of resources
”.
One way to construct a value to pass in here would be as follows:
cluster_encryption_config = [
{
provider_key_arn = var.aws_kms_key_arn,
resources = ["secrets"],
}
]
Does this answer your question?
Thanks for reaching back out I really appreciate your assistances the way you are addressing that would I change my variable type to something else and I guess how would I add that into my current syntax ?
variable "cluster_encryption_config" {
type = list(object({
provider_key_arn = string
resources = list(string)
}))
default = []
}
What you linked to is the GitHub repo of a public registry module, which I assumed your Terraform configuration was using. Is that the case? If so, your module call should include a reference to your KMS key as in my previous reply.
For the code from my previous reply, the aws_kms_key_arn
variable would be a string
type.
If you can include some of your own Terraform configuration in a future reply, it would make it easier for someone to suggest changes.