Hello, I have a resource aws_kms_key
which has been created through for_each
expression, now I need to locate its arn
to use with ecr
repository, can you help me how to do that?
Here is the output it self:
+ test1 = {
+ KMS Key For - Cluster Loggroup = "arn:aws:kms:eu-west-1:771664210945:key/044c6d77-df44-4b47-a51e-17b4c4561319"
+ KMS Key For - Container Registry = "arn:aws:kms:eu-west-1:771664210945:key/e0d919d7-137c-46ec-b99c-07e7ad07af3a"
+ KMS Key For - Flowlog Loggroup = "arn:aws:kms:eu-west-1:771664210945:key/184fbca3-2845-4b72-bd64-b4d167610b1c"
}
Or, I’ve also have this kind of output
+ test2 = {
+ alias/dev/cluster = "arn:aws:kms:eu-west-1:771664210945:key/044c6d77-df44-4b47-a51e-17b4c4561319"
+ alias/dev/flowlogs = "arn:aws:kms:eu-west-1:771664210945:key/184fbca3-2845-4b72-bd64-b4d167610b1c"
+ alias/dev/registry = "arn:aws:kms:eu-west-1:771664210945:key/e0d919d7-137c-46ec-b99c-07e7ad07af3a"
}
output "key" {
description = "The 'Amazon Resource Name (ARN)' of key"
value = zipmap(
values(aws_kms_key.global)[*].description, values(aws_kms_key.global)[*].arn
)
}
So how to grep for example the Container Registry, and make something like:
module.kms.arn.container