little-cartoon-10569
02/26/2026, 3:24 AMnew BucketPolicyArgs {
Bucket = bucket.Id,
Policy = Output.JsonSerialize(Output.Create(new {
Version = "2012-10-17",
Statement = new[] {
new {
Effect = "Allow",
Principal = new {
AWS = Output.Format($"arn:aws:iam::{accountID}:root")
},
Action = "s3:ListBucket",
Resource = bucket.Arn
}
}
}
}
Is it possible to use the syntax with property names that C# doesn't (seem to) support? In particular, how would I get this into the Statement?
"Condition": {
"StringEquals": {
"AWS:SourceArn": "arn:aws:cloudfront::<YOUR_AMAZON_ACCOUNT_ID>:distribution/<CLOUDFRONT_DISTRIBUTION_ID>"
}
}
That colon in AWS:SourceArn is not playing ball...
ref: https://www.pulumi.com/docs/iac/concepts/inputs-outputs/helpers/little-cartoon-10569
02/26/2026, 3:47 AM// ...
Statement = new[] {
new {
Sid = "PublicReadGetObject",
Effect = Aws.Iam.PolicyStatementEffect.ALLOW.ToString(),
Principal = new
{
Service = "<http://cloudfront.amazonaws.com|cloudfront.amazonaws.com>"
},
Action = "s3:GetObject",
Resource = Output.Format($"arn:aws:s3:::{bucket.BucketName}/*"),
Condition = new
{
StringEquals = new Dictionary<string, Output<string>>
{
["AWS:SourceArn"] = Output.Format($"arn:aws:cloudfront::{accountId}:distribution/{cdn.Id}")
}
}
}
}