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

bug: Parameter type ignored when passed to NestedStacks #9558

Closed
1 task done
lukasz-mazur2 opened this issue Nov 6, 2023 · 2 comments
Closed
1 task done

bug: Parameter type ignored when passed to NestedStacks #9558

lukasz-mazur2 opened this issue Nov 6, 2023 · 2 comments
Labels
aws:cloudformation AWS CloudFormation status: backlog Triaged but not yet being worked on status: resolved/stale Closed due to staleness type: bug Bug report

Comments

@lukasz-mazur2
Copy link

lukasz-mazur2 commented Nov 6, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

It appears that parameters passed down to a Nested Stack are always treated as a string.

Template:

AWSTemplateFormatVersion: '2010-09-09'
Resources:
  RDSDevMysql:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: http://standard-common-modules.s3.localhost.localstack.cloud:443/templates/cloudformation-rds/4/0/cloudformation-rds-v4.0.1.yaml
      Parameters:
        ResourceNamePrefix: !Sub ${AWS::StackName}-dev-mysql
        Mode: dev
        Engine: mysql-8
        MasterUsername: testadmin
        VpcId: vpc-db9885d5
        SubnetIds: subnet-4f49ee6b,subnet-d560b0cb,subnet-c4723f8f

What nested stack template is expecting:

  SubnetIds:
    Type: CommaDelimitedList

Inside the rds nested stack template we use a PyPlate macro and in its logs I can see that SubnetIds are a single string:

(...)
 "transformId":"000000000000::PyPlate",
   "params":{
      
   },
   "requestId":"021c8704-d328-4b55-a55a-8949a0ec322a",
   "templateParameterValues":{
      "ResourceNamePrefix":"rds-test-dev-mysql",
      "Mode":"dev",
      "Engine":"mysql-8",
      "MasterUsername":"testadmin",
      "VpcId":"vpc-db9885d5",
      "SubnetIds":"subnet-4f49ee6b,subnet-d560b0cb,subnet-c4723f8f",                     <---------------- single string
      "BackupRegion":"eu-central-1",
      "MysqlSlowQueryTime":5,
(...)

Expected Behavior

This is how it looks on AWS:

(...)
 "transformId":"000000000000::PyPlate",
   "params":{
      
   },
   "requestId":"2de8a855-7e00-49c2-94fb-2b3e5959b7bd",
   "templateParameterValues":{
      "ResourceNamePrefix":"rds-test-dev-mysql",
      "Mode":"dev",
      "Engine":"mysql-8",
      "MasterUsername":"testadmin",
      "VpcId":"vpc-db9885d5",
      "SubnetIds": [
          "subnet-4f49ee6b",                  <------\
          "subnet-d560b0cb",                  <------->------ list
          "subnet-c4723f8f"                   <------/
      ],
      "BackupRegion":"eu-central-1",
      "MysqlSlowQueryTime":5,
(...)

How are you starting LocalStack?

With a docker run command

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

docker run \
--rm \
--name localstack_main \
-p 4566:4566 \
-p 4510-4559:4510-4559 \
-e LOCALSTACK_API_KEY=$LOCALSTACK_API_KEY \
-e PERSISTENCE=0\
-e LS_LOG=trace \
-e SNAPSHOT_LOAD_STRATEGY=ON_STARTUP \
-v ./localstack-volume:/var/lib/localstack \
-v /var/run/docker.sock:/var/run/docker.sock \
    localstack/localstack-pro

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

awslocal cloudformation create-stack --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND --stack-name rds-test --template-body file://template.yaml && awslocal cloudformation wait stack-create-complete --stack-name rds-test

Environment

- OS: 5.15.90.1-microsoft-standard-WSL2
- LocalStack: 2.3.3.dev20231010111126

Anything else?

No response

@lukasz-mazur2 lukasz-mazur2 added status: triage needed Requires evaluation by maintainers type: bug Bug report labels Nov 6, 2023
@lukasz-mazur2
Copy link
Author

Another example from different template.

AWSTemplateFormatVersion: '2010-09-09'

Parameters:
  VPC:
    Type: AWS::EC2::VPC::Id
    Default: vpc-db9885d5

Resources:
  SecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupName: private-zone-sg-test-for-ingress
      GroupDescription: Test security group
      VpcId: !Ref VPC
  SourceSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupName:  private-zone-sg-test-for-ingress-source
      GroupDescription: Test source security group
      VpcId: !Ref VPC
  IngressCIDR:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: http://standard-common-modules.s3.localhost.localstack.cloud:443/templates/cloudformation-private-zone-sg-ingress/1/0/cloudformation-private-zone-sg-ingress-v1.0.3.yaml
      Parameters:
        ResourceNamePrefix: sg-cidr
        GroupID: !GetAtt SecurityGroup.GroupId
        IPProtocol: tcp
        CIDR: 0.0.0.0/0
        From: 6000
        To: 7000

Results in Nested Stack parameter validation error:

Parameter validation failed: Invalid type for parameter FromPort, value: 6000, type: <class 'str'>, valid types: <class 'int'> Invalid type for parameter ToPort, value: 7000, type: <class 'str'>, valid types: <class 'int'> Invalid type for parameter IpPermissions[0].FromPort, value: 6000, type: <class 'str'>, valid types: <class 'int'> Invalid type for parameter IpPermissions[0].ToPort, value: 7000, type: <class 'str'>, valid types: <class 'int'>

@alexrashed alexrashed added status: backlog Triaged but not yet being worked on aws:cloudformation AWS CloudFormation and removed status: triage needed Requires evaluation by maintainers labels Nov 15, 2023
@localstack-bot
Copy link
Collaborator

Hello 👋! It looks like this issue hasn’t been active in longer than five months. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

@localstack-bot localstack-bot added the status: stale To be closed soon due to staleness label Apr 13, 2024
@localstack-bot localstack-bot added status: resolved/stale Closed due to staleness and removed status: stale To be closed soon due to staleness labels Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:cloudformation AWS CloudFormation status: backlog Triaged but not yet being worked on status: resolved/stale Closed due to staleness type: bug Bug report
Projects
None yet
Development

No branches or pull requests

3 participants