Skip to content

Commit

Permalink
Use Aws.Partition where it could include govCloud
Browse files Browse the repository at this point in the history
  • Loading branch information
biffgaut committed Mar 31, 2023
1 parent b65986d commit 489f7a3
Show file tree
Hide file tree
Showing 29 changed files with 309 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ export class ApiGatewayToIot extends Construct {
Action: [
"iot:UpdateThingShadow"
],
Resource: `arn:aws:iot:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:thing/*`,
Resource: `arn:${cdk.Aws.PARTITION}:iot:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:thing/*`,
Effect: "Allow"
},
{
Action: [
"iot:Publish"
],
Resource: `arn:aws:iot:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:topic/*`,
Resource: `arn:${cdk.Aws.PARTITION}:iot:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:topic/*`,
Effect: "Allow"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ const policyJSON = {
Action: [
"iot:UpdateThingShadow"
],
Resource: `arn:aws:iot:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:thing/*`,
Resource: `arn:${cdk.Aws.PARTITION}:iot:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:thing/*`,
Effect: "Allow"
},
{
Action: [
"iot:Publish"
],
Resource: `arn:aws:iot:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:topic/*`,
Resource: `arn:${arn:${Aws.PARTITION}:Aws.PARTITION}:iot:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:topic/*`,
Effect: "Allow"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,14 @@ test('Test for overriden IAM Role', () => {
Action: [
"iot:UpdateThingShadow"
],
Resource: `arn:aws:iot:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:thing/mything1`,
Resource: `arn:$${cdk.Aws.PARTITION}:iot:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:thing/mything1`,
Effect: "Allow"
},
{
Action: [
"iot:Publish"
],
Resource: `arn:aws:iot:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:topic/topic-abc`,
Resource: `arn:${cdk.Aws.PARTITION}:iot:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:topic/topic-abc`,
Effect: "Allow"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const mediaStoreContainerProps: mediastore.CfnContainerProps = {
Effect: 'Allow',
Principal: '*',
Action: 'mediastore:*',
Resource: `arn:aws:mediastore:${Aws.REGION}:${Aws.ACCOUNT_ID}:container/MyOwnMediaStoreContainer/*`,
Resource: `arn:${Aws.PARTITION}:mediastore:${Aws.REGION}:${Aws.ACCOUNT_ID}:container/MyOwnMediaStoreContainer/*`,
Condition: {
Bool: { "aws:SecureTransport": "true" }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ test('test cloudfront disable cloudfront logging', () => {
test('test cloudfront with custom domain names', () => {
const stack = new cdk.Stack();

const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012');
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:${Aws.PARTITION}:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012');

const props: CloudFrontToS3Props = {
cloudFrontDistributionProps: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,11 @@
"Fn::Join": [
"",
[
"arn:aws:cognito-identity:",
"arn:",
{
"Ref": "AWS::Partition"
},
":cognito-identity:",
{
"Ref": "AWS::Region"
},
Expand All @@ -513,7 +517,11 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
Expand Down Expand Up @@ -581,8 +589,12 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
":",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,11 @@
"Fn::Join": [
"",
[
"arn:aws:cognito-identity:",
"arn:",
{
"Ref": "AWS::Partition"
},
":cognito-identity:",
{
"Ref": "AWS::Region"
},
Expand All @@ -443,7 +447,11 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
Expand Down Expand Up @@ -511,8 +519,12 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
":",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ test('Test cognito dashboard role IAM policy', () => {
"Fn::Join": [
"",
[
"arn:aws:cognito-identity:",
"arn:",
{
Ref: "AWS::Partition"
},
":cognito-identity:",
{
Ref: "AWS::Region"
},
Expand All @@ -138,7 +142,11 @@ test('Test cognito dashboard role IAM policy', () => {
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
Ref: "AWS::Partition"
},
":es:",
{
Ref: "AWS::Region"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,11 @@
"Fn::Join": [
"",
[
"arn:aws:cognito-identity:",
"arn:",
{
"Ref": "AWS::Partition"
},
":cognito-identity:",
{
"Ref": "AWS::Region"
},
Expand All @@ -1260,7 +1264,11 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
Expand Down Expand Up @@ -1320,8 +1328,12 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
":",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,11 @@
"Fn::Join": [
"",
[
"arn:aws:cognito-identity:",
"arn:",
{
"Ref": "AWS::Partition"
},
":cognito-identity:",
{
"Ref": "AWS::Region"
},
Expand All @@ -238,7 +242,11 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
Expand Down Expand Up @@ -298,8 +306,12 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
":",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,11 @@
"Fn::Join": [
"",
[
"arn:aws:cognito-identity:",
"arn:",
{
"Ref": "AWS::Partition"
},
":cognito-identity:",
{
"Ref": "AWS::Region"
},
Expand All @@ -442,7 +446,11 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
Expand Down Expand Up @@ -510,8 +518,12 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
":",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,11 @@
"Fn::Join": [
"",
[
"arn:aws:cognito-identity:",
"arn:",
{
"Ref": "AWS::Partition"
},
":cognito-identity:",
{
"Ref": "AWS::Region"
},
Expand All @@ -1116,7 +1120,11 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
Expand Down Expand Up @@ -1184,8 +1192,12 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
":",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,11 @@
"Fn::Join": [
"",
[
"arn:aws:cognito-identity:",
"arn:",
{
"Ref": "AWS::Partition"
},
":cognito-identity:",
{
"Ref": "AWS::Region"
},
Expand All @@ -444,7 +448,11 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
Expand Down Expand Up @@ -512,8 +520,12 @@
"Fn::Join": [
"",
[
"arn:aws:es:",
"arn:",
{
"Ref": "AWS::Partition"
},
":es:",
{
"Ref": "AWS::Region"
},
":",
Expand Down
Loading

0 comments on commit 489f7a3

Please sign in to comment.