We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am using following resource block:
resource "aws_kms_key_policy" "cmk" { key_id = data.aws_kms_key.by_alias.id policy = jsonencode({
"Version": "2012-10-17", "Statement": [ { "Sid": "SId#1", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::123456789:root" }, "Action": "kms:CreateGrant", "Resource": "*", "Condition": { "StringEquals": { "kms:CallerAccount": "123456789", "kms:GranteePrincipal": "arn:aws:iam::123456789:role/aws-service-role/mgn.amazonaws.com/AWSServiceRoleForApplicationMigrationService" }, "ForAllValues:StringEquals": { "kms:GrantOperations": [ "CreateGrant", "DescribeKey", "Encrypt", "Decrypt", "GenerateDataKey", "GenerateDataKeyWithoutPlaintext" ] }, "Bool": { "aws:ViaAWSService": "true" } } }, { "Sid": "Sid#2", "Effect": "Allow", "Principal": { "AWS": [ "arn:aws:iam::123456789:root", "arn:aws:iam::123456789:role/aws-service-role/mgn.amazonaws.com/AWSServiceRoleForApplicationMigrationService" ] }, "Action": [ "kms:ReEncrypt*", "kms:GenerateDataKey*" ], "Resource": "*", "Condition": { "StringEquals": { "kms:CallerAccount": "123456789", "kms:ViaService": "ec2.us-east-1.amazonaws.com" } } } ]
} ) }
terraform plan output
+ "kms:CallerAccount" = "123456789" + "kms:GranteePrincipal" = "arn:aws:iam::123456789:role/aws-service-role/mgn.amazonaws.com/AWSServiceRoleForApplicationMigrationService" } } + Effect = "Allow" + Principal = { + AWS = "arn:aws:iam::123456789:root" } + Resource = "*" + Sid = "Sid#2" }, + { + Action = [ + "kms:ReEncrypt*", + "kms:GenerateDataKey*", ] + Condition = { + StringEquals = { + "kms:CallerAccount" = "123456789" + "kms:ViaService" = "ec2.***.amazonaws.com" } } + Effect = "Allow" + Principal = { + AWS = [ + "arn:aws:iam::123456789:root", + "arn:aws:iam::123456789:role/aws-service-role/mgn.amazonaws.com/AWSServiceRoleForApplicationMigrationService", ] } + Resource = "*" + Sid = "Sid#1" }, ] + Version = "2012-10-17" } ) }
I don't understand why the kms:ViaService = ec2..amazonaws.com in output with three star () rather than exact region name.
provider "aws" { region = var.region }
terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 4.0" } }
1.0.0, 1.1.0, 1.2.0
The text was updated successfully, but these errors were encountered:
Hey, thanks for your contribution! Please give us a bit of time to review it. 😄
Be sure to follow the issue template!
Sorry, something went wrong.
No branches or pull requests
Is there an existing issue for this?
Description of the bug
I am using following resource block:
resource "aws_kms_key_policy" "cmk" {
key_id = data.aws_kms_key.by_alias.id
policy = jsonencode({
}
)
}
terraform plan output
I don't understand why the kms:ViaService = ec2..amazonaws.com in output with three star () rather than exact region name.
Steps To Reproduce
provider "aws" {
region = var.region
}
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
Which version of the app are you using?
1.0.0, 1.1.0, 1.2.0
The text was updated successfully, but these errors were encountered: