Skip to content

core: CrossRegion References does'nt work withn exporting to multiple regions. #25377

@mrpackethead

Description

@mrpackethead

Describe the bug

The bug fix provided in release 2.77.0

core: crossRegionReferences doesn't work when exporting to multiple regions (#25190) (89b26b8), closes #24464

Does not appear to have resolved the issue.

The inline policy for the CustomRegionExportWriter... Role is only providing access to a single zone. Synthed cf template., you can see this.

"CustomCrossRegionExportWriterCustomResourceProviderRoleC951B1E1": {
  "Type": "AWS::IAM::Role",
  "Properties": {
   "AssumeRolePolicyDocument": {
    "Version": "2012-10-17",
    "Statement": [
     {
      "Action": "sts:AssumeRole",
      "Effect": "Allow",
      "Principal": {
       "Service": "lambda.amazonaws.com"
      }
     }
    ]
   },
   "ManagedPolicyArns": [
    {
     "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
    }
   ],
   "Policies": [
    {
     "PolicyName": "Inline",
     "PolicyDocument": {
      "Version": "2012-10-17",
      "Statement": [
       {
        "Effect": "Allow",
        "Resource": [
         "arn:aws:ssm:ap-southeast-1:8xxxxxxxxxxxx2:parameter/cdk/exports/*"
        ],
        "Action": [
         "ssm:DeleteParameters",
         "ssm:ListTagsForResource",
         "ssm:GetParameters",
         "ssm:PutParameter"
        ]
       }
      ]
     }
    }
   ]
  },


"ExportsWriterapsoutheast2235C849A8E92266D": {
  "Type": "Custom::CrossRegionExportWriter",
  "Properties": {
   "ServiceToken": {
    "Fn::GetAtt": [
     "CustomCrossRegionExportWriterCustomResourceProviderHandlerD8786E8A",
     "Arn"
    ]
   },
   "WriterProps": {
    "region": "ap-southeast-2",
    "exports": {
     "/cdk/exports/ap-southeast-2-centralVPC/supportInfrauseast1FnGetAttearthIPAMPoolIpamPoolId4B9BFE48": {
      "Fn::GetAtt": [
       "earthIPAMPool",
       "IpamPoolId"
      ]
     },
     "/cdk/exports/ap-southeast-2-centralVPC/supportInfrauseast1Refloggingbucket6D73BD53592114C2": {
      "Ref": "loggingbucket6D73BD53"
     },
     "/cdk/exports/ap-southeast-2-workloadVPC/supportInfrauseast1FnGetAttearthIPAMPoolIpamPoolId4B9BFE48": {
      "Fn::GetAtt": [
       "earthIPAMPool",
       "IpamPoolId"
      ]
     },
     "/cdk/exports/ap-southeast-2-workloadVPC/supportInfrauseast1Refloggingbucket6D73BD53592114C2": {
      "Ref": "loggingbucket6D73BD53"
     }
    }
   }
  },
  "UpdateReplacePolicy": "Delete",
  "DeletionPolicy": "Delete",
  "Metadata": {
   "aws:cdk:path": "supportInfra/ExportsWriterapsoutheast2235C849A/Resource/Default"
  }
 }
},

Expected Behavior

should have added multiple regions.

Current Behavior

only added one region.

Reproduction Steps

import * as cdk from 'aws-cdk-lib';
import { Stack } from 'aws-cdk-lib';

const app = new cdk.App();
var sourceStack = new Stack(app, 'sourceStack', {  env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'us-east-1' } });
var hostedZone = new cdk.aws_route53.HostedZone(sourceStack, "hostedZone", { zoneName: 'test.local'});

var destRegion1Stack = new Stack(app, 'Region1Stack',  {  env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'ap-southeast-1' }, crossRegionReferences: true });
new cdk.aws_route53.TxtRecord(destRegion1Stack, "FirstARecord", { zone: hostedZone, recordName: 'ap-southeast-1', values: ['ap-southeast-1'] });

var destRegion2Stack = new Stack(app, 'Region2Stack',  {  env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'ap-southeast-2' }, crossRegionReferences: true });
new cdk.aws_route53.TxtRecord(destRegion2Stack, "SecondARecord", { zone: hostedZone, recordName: 'ap-southeast-2', values: ['ap-southeast-2'] });

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.77.0

Framework Version

No response

Node.js Version

16.15.1

OS

Amazon Linux 2

Language

Typescript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

@aws-cdk/coreRelated to core CDK functionalitybugThis issue is a bug.effort/smallSmall work item – less than a day of effortin-progressThis issue is being actively worked on.p2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions