Skip to content
New issue

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

core: ap-southeast-4 is missing in AWS_REGIONS_AND_RULES #25796

Closed
zxkane opened this issue May 31, 2023 · 7 comments
Closed

core: ap-southeast-4 is missing in AWS_REGIONS_AND_RULES #25796

zxkane opened this issue May 31, 2023 · 7 comments
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug. effort/medium Medium work item – several days of effort p1

Comments

@zxkane
Copy link
Contributor

zxkane commented May 31, 2023

Describe the bug

Create a simple CDK app with Step Functions like below

import { App, Stack, StackProps, Duration } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { Wait, WaitTime, Fail, StateMachine } from 'aws-cdk-lib/aws-stepfunctions';

export class MyStack extends Stack {
  constructor(scope: Construct, id: string, props: StackProps = {}) {
    super(scope, id, props);

    const waitX = new Wait(this, 'Wait X Seconds', {
      time: WaitTime.secondsPath('$.waitSeconds'),
    });
    
    
    
    const jobFailed = new Fail(this, 'Job Failed', {
      cause: 'AWS Batch Job Failed',
      error: 'DescribeJob returned FAILED',
    });
    
    
    const definition = waitX
      .next(jobFailed);
    
    new StateMachine(this, 'StateMachine', {
      definition,
      timeout: Duration.minutes(5),
    });
  }
}

const app = new App();

new MyStack(app, 'simple-sfn', {  });

app.synth();

Deploy it then got below error,

 ❌ Deployment failed: Error [ValidationError]: Template error: Unable to get mapping for ServiceprincipalMap::ap-southeast-4::states
    at Request.extractError (/home/ubuntu/environment/tmp/s3-default-acl/node_modules/aws-cdk/lib/index.js:292:46245)
    at Request.callListeners (/home/ubuntu/environment/tmp/s3-default-acl/node_modules/aws-cdk/lib/index.js:292:89237)
    at Request.emit (/home/ubuntu/environment/tmp/s3-default-acl/node_modules/aws-cdk/lib/index.js:292:88685)
    at Request.emit (/home/ubuntu/environment/tmp/s3-default-acl/node_modules/aws-cdk/lib/index.js:292:195114)
    at Request.transition (/home/ubuntu/environment/tmp/s3-default-acl/node_modules/aws-cdk/lib/index.js:292:188666)
    at AcceptorStateMachine.runTo (/home/ubuntu/environment/tmp/s3-default-acl/node_modules/aws-cdk/lib/index.js:292:153538)
    at /home/ubuntu/environment/tmp/s3-default-acl/node_modules/aws-cdk/lib/index.js:292:153868
    at Request.<anonymous> (/home/ubuntu/environment/tmp/s3-default-acl/node_modules/aws-cdk/lib/index.js:292:188958)
    at Request.<anonymous> (/home/ubuntu/environment/tmp/s3-default-acl/node_modules/aws-cdk/lib/index.js:292:195189)
    at Request.callListeners (/home/ubuntu/environment/tmp/s3-default-acl/node_modules/aws-cdk/lib/index.js:292:89405) {
  code: 'ValidationError',
  time: 2023-05-31T15:34:51.679Z,
  requestId: 'ffe2493d-e15b-48b2-9870-0988aa7ac7f2',
  statusCode: 400,
  retryable: false,
  retryDelay: 89.89593283858954

Expected Behavior

The app can be deployed without errors.

Current Behavior

see above

Reproduction Steps

see above

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.81.0

Framework Version

No response

Node.js Version

16.20.0

OS

ubuntu 18.04

Language

Typescript

Language Version

No response

Other information

No response

@zxkane zxkane added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 31, 2023
@github-actions github-actions bot added the @aws-cdk/core Related to core CDK functionality label May 31, 2023
@pahud pahud self-assigned this Jun 1, 2023
@pahud pahud added investigating This issue is being investigated and/or work is in progress to resolve the issue. p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jun 1, 2023
@pahud
Copy link
Contributor

pahud commented Jun 1, 2023

@zxkane

I can't reproduce it. Can you paste the full CDK synth output in the comment?

@pahud pahud added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 1, 2023
@zxkane
Copy link
Contributor Author

zxkane commented Jun 2, 2023

@zxkane

I can't reproduce it. Can you paste the full CDK synth output in the comment?

Below is the synth output for above sample code with v2.81.0

$ npx cdk --version
2.81.0 (build bd920f2)

# ubuntu @ ip-172-31-7-27 in ~/environment/tmp/cdk-samples on git:master o [14:42:15] 
$ npx cdk synth -a "npx ts-node -P tsconfig.json --prefer-ts-exts src/simple-sfn.ts" 
There are expired AWS credentials in your environment. The CDK app will synth without current account information.
Resources:
  StateMachineRoleB840431D:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: sts:AssumeRole
            Effect: Allow
            Principal:
              Service:
                Fn::FindInMap:
                  - ServiceprincipalMap
                  - Ref: AWS::Region
                  - states
        Version: "2012-10-17"
    Metadata:
      aws:cdk:path: simple-sfn/StateMachine/Role/Resource
  StateMachine2E01A3A5:
    Type: AWS::StepFunctions::StateMachine
    Properties:
      RoleArn:
        Fn::GetAtt:
          - StateMachineRoleB840431D
          - Arn
      DefinitionString: '{"StartAt":"Wait X Seconds","States":{"Wait X Seconds":{"Type":"Wait","SecondsPath":"$.waitSeconds","Next":"Job Failed"},"Job Failed":{"Type":"Fail","Error":"DescribeJob returned FAILED","Cause":"AWS Batch Job Failed"}},"TimeoutSeconds":300}'
    DependsOn:
      - StateMachineRoleB840431D
    UpdateReplacePolicy: Delete
    DeletionPolicy: Delete
    Metadata:
      aws:cdk:path: simple-sfn/StateMachine/Resource
  CDKMetadata:
    Type: AWS::CDK::Metadata
    Properties:
      Analytics: v2:deflate64:H4sIAAAAAAAA/01OPQ+CMBD9Le7HCQzGncSNBQdGc5aix8eV0KJD0/9uKwvT+8zLK/FaYH6ir81UN2YTP9HfHakRovXw1uml30Q5NmLRt8QObsQTxI7TNak3i4aql6MOwDSjb8z0jxKGAI22ZlvVbh14ZaTjtJ9ETcvC8gogptM42POnuGCZx4eDZc7WTRzPGpsdf5LOa2a9AAAA
    Metadata:
      aws:cdk:path: simple-sfn/CDKMetadata/Default
    Condition: CDKMetadataAvailable
Conditions:
  CDKMetadataAvailable:
    Fn::Or:
      - Fn::Or:
          - Fn::Equals:
              - Ref: AWS::Region
              - af-south-1
          - Fn::Equals:
              - Ref: AWS::Region
              - ap-east-1
          - Fn::Equals:
              - Ref: AWS::Region
              - ap-northeast-1
          - Fn::Equals:
              - Ref: AWS::Region
              - ap-northeast-2
          - Fn::Equals:
              - Ref: AWS::Region
              - ap-south-1
          - Fn::Equals:
              - Ref: AWS::Region
              - ap-southeast-1
          - Fn::Equals:
              - Ref: AWS::Region
              - ap-southeast-2
          - Fn::Equals:
              - Ref: AWS::Region
              - ca-central-1
          - Fn::Equals:
              - Ref: AWS::Region
              - cn-north-1
          - Fn::Equals:
              - Ref: AWS::Region
              - cn-northwest-1
      - Fn::Or:
          - Fn::Equals:
              - Ref: AWS::Region
              - eu-central-1
          - Fn::Equals:
              - Ref: AWS::Region
              - eu-north-1
          - Fn::Equals:
              - Ref: AWS::Region
              - eu-south-1
          - Fn::Equals:
              - Ref: AWS::Region
              - eu-west-1
          - Fn::Equals:
              - Ref: AWS::Region
              - eu-west-2
          - Fn::Equals:
              - Ref: AWS::Region
              - eu-west-3
          - Fn::Equals:
              - Ref: AWS::Region
              - me-south-1
          - Fn::Equals:
              - Ref: AWS::Region
              - sa-east-1
          - Fn::Equals:
              - Ref: AWS::Region
              - us-east-1
          - Fn::Equals:
              - Ref: AWS::Region
              - us-east-2
      - Fn::Or:
          - Fn::Equals:
              - Ref: AWS::Region
              - us-west-1
          - Fn::Equals:
              - Ref: AWS::Region
              - us-west-2
Mappings:
  ServiceprincipalMap:
    af-south-1:
      states: states.af-south-1.amazonaws.com
    ap-east-1:
      states: states.ap-east-1.amazonaws.com
    ap-northeast-1:
      states: states.ap-northeast-1.amazonaws.com
    ap-northeast-2:
      states: states.ap-northeast-2.amazonaws.com
    ap-northeast-3:
      states: states.ap-northeast-3.amazonaws.com
    ap-south-1:
      states: states.ap-south-1.amazonaws.com
    ap-south-2:
      states: states.ap-south-2.amazonaws.com
    ap-southeast-1:
      states: states.ap-southeast-1.amazonaws.com
    ap-southeast-2:
      states: states.ap-southeast-2.amazonaws.com
    ap-southeast-3:
      states: states.ap-southeast-3.amazonaws.com
    ca-central-1:
      states: states.ca-central-1.amazonaws.com
    cn-north-1:
      states: states.cn-north-1.amazonaws.com
    cn-northwest-1:
      states: states.cn-northwest-1.amazonaws.com
    eu-central-1:
      states: states.eu-central-1.amazonaws.com
    eu-central-2:
      states: states.eu-central-2.amazonaws.com
    eu-north-1:
      states: states.eu-north-1.amazonaws.com
    eu-south-1:
      states: states.eu-south-1.amazonaws.com
    eu-south-2:
      states: states.eu-south-2.amazonaws.com
    eu-west-1:
      states: states.eu-west-1.amazonaws.com
    eu-west-2:
      states: states.eu-west-2.amazonaws.com
    eu-west-3:
      states: states.eu-west-3.amazonaws.com
    me-central-1:
      states: states.me-central-1.amazonaws.com
    me-south-1:
      states: states.me-south-1.amazonaws.com
    sa-east-1:
      states: states.sa-east-1.amazonaws.com
    us-east-1:
      states: states.us-east-1.amazonaws.com
    us-east-2:
      states: states.us-east-2.amazonaws.com
    us-gov-east-1:
      states: states.us-gov-east-1.amazonaws.com
    us-gov-west-1:
      states: states.us-gov-west-1.amazonaws.com
    us-iso-east-1:
      states: states.amazonaws.com
    us-iso-west-1:
      states: states.amazonaws.com
    us-isob-east-1:
      states: states.amazonaws.com
    us-west-1:
      states: states.us-west-1.amazonaws.com
    us-west-2:
      states: states.us-west-2.amazonaws.com
Parameters:
  BootstrapVersion:
    Type: AWS::SSM::Parameter::Value<String>
    Default: /cdk-bootstrap/hnb659fds/version
    Description: Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]
Rules:
  CheckBootstrapVersion:
    Assertions:
      - Assert:
          Fn::Not:
            - Fn::Contains:
                - - "1"
                  - "2"
                  - "3"
                  - "4"
                  - "5"
                - Ref: BootstrapVersion
        AssertDescription: CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 2, 2023
@zxkane
Copy link
Contributor Author

zxkane commented Jun 5, 2023

@pahud I found there is a feature flag @aws-cdk/aws-iam:standardizedServicePrincipals could remove above ServiceprincipalMap, it's also safe for my use case.

https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/cx-api/FEATURE_FLAGS.md#aws-cdkaws-iamstandardizedserviceprincipals

However, my application specifies the log rention period of Lambda function, it introduceds another map named DefaultCrNodeVersionMap missing the ap-southeast-4 too.

Runtime: cdk.Stack.of(scope).regionalFact(FactName.DEFAULT_CR_NODE_VERSION, 'nodejs16.x'), // Equivalent to Runtime.NODEJS_16_X

@pahud
Copy link
Contributor

pahud commented Jun 6, 2023

@zxkane

Yeah. I guess we just missed ap-southeast-4 here. We probably should add it in immediately.

@pahud pahud added p1 needs-review and removed p2 investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Jun 6, 2023
@pahud pahud removed their assignment Jun 6, 2023
@pahud pahud changed the title (core): can not deploy app with step functions in ap-southeast-4 core: ap-southeast-4 is missing in AWS_REGIONS_AND_RULES Jun 6, 2023
@pahud pahud removed the needs-review label Jun 6, 2023
@pahud
Copy link
Contributor

pahud commented Jun 7, 2023

to be closed by #25890

@colifran
Copy link
Contributor

Closed by #26919

Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug. effort/medium Medium work item – several days of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants