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

Having stacks in different regions with the same name (again) does not work #5832

Closed
konstantinj opened this issue Jan 16, 2020 · 5 comments
Closed
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@konstantinj
Copy link

I'm confused. Afaik this should work now after #4412 #4895
Doing cdk ls in the code below shows me only one stack test.
When I cdk deploy test only the stack in region us-east-1 gets deployed.

Is it still not possible to have stacks in different regions with the same name?

Reproduction Steps

const app = new cdk.App
new Stack(app, 'test1', {stackName:'test', env: {account: 'xxxxxxxxxxxx', region: 'eu-west-1'}})
new Stack(app, 'test2', {stackName:'test', env: {account: 'xxxxxxxxxxxx', region: 'us-east-1'}})

Environment

  • CLI Version : 1.21.0
  • Framework Version: 1.21.0
  • OS : osx
  • Language : typescript

This is 🐛 Bug Report

@konstantinj konstantinj added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 16, 2020
@eladb
Copy link
Contributor

eladb commented Jan 16, 2020

Can you share your cdk.context.json?

@konstantinj
Copy link
Author

konstantinj commented Jan 16, 2020

{
  "vpc-provider:account=xxxxxxxxxxxx:filter.tag:Name=skynet:region=eu-west-1:returnAsymmetricSubnets=true": {
    "vpcId": "vpc-8c7607eb",
    "vpcCidrBlock": "10.200.64.0/18",
    "availabilityZones": [],
    "vpnGatewayId": "vgw-da2419ae",
    "subnetGroups": [
      {
        "name": "Private",
        "type": "Private",
        "subnets": [
          {
            "subnetId": "subnet-07620d60",
            "cidr": "10.200.64.0/21",
            "availabilityZone": "eu-west-1a",
            "routeTableId": "rtb-2a469d4c"
          },
          {
            "subnetId": "subnet-642c5a2d",
            "cidr": "10.200.72.0/21",
            "availabilityZone": "eu-west-1b",
            "routeTableId": "rtb-2a469d4c"
          },
          {
            "subnetId": "subnet-bb1fb7e0",
            "cidr": "10.200.80.0/21",
            "availabilityZone": "eu-west-1c",
            "routeTableId": "rtb-2a469d4c"
          }
        ]
      },
      {
        "name": "Public",
        "type": "Public",
        "subnets": [
          {
            "subnetId": "subnet-c77d12a0",
            "cidr": "10.200.88.0/21",
            "availabilityZone": "eu-west-1a",
            "routeTableId": "rtb-e0479c86"
          },
          {
            "subnetId": "subnet-fe2d5bb7",
            "cidr": "10.200.96.0/21",
            "availabilityZone": "eu-west-1b",
            "routeTableId": "rtb-e0479c86"
          },
          {
            "subnetId": "subnet-da1fb781",
            "cidr": "10.200.104.0/21",
            "availabilityZone": "eu-west-1c",
            "routeTableId": "rtb-e0479c86"
          }
        ]
      }
    ]
  },
  "hosted-zone:account=xxxxxxxxxxxx:domainName=example.com:region=eu-west-1": {
    "Id": "/hostedzone/ZT2IZMVV4BYC3",
    "Name": "example.com."
  },
  "vpc-provider:account=xxxxxxxxxxxx:filter.tag:Name=skynet:region=us-east-1:returnAsymmetricSubnets=true": {
    "vpcId": "vpc-2ac65052",
    "vpcCidrBlock": "10.200.128.0/22",
    "availabilityZones": [],
    "vpnGatewayId": "vgw-9136c3f8",
    "subnetGroups": [
      {
        "name": "Public",
        "type": "Public",
        "subnets": [
          {
            "subnetId": "subnet-3c26b177",
            "cidr": "10.200.130.0/24",
            "availabilityZone": "us-east-1a",
            "routeTableId": "rtb-4cc8fa36"
          },
          {
            "subnetId": "subnet-e55e91b8",
            "cidr": "10.200.131.0/24",
            "availabilityZone": "us-east-1b",
            "routeTableId": "rtb-4cc8fa36"
          }
        ]
      },
      {
        "name": "Private",
        "type": "Private",
        "subnets": [
          {
            "subnetId": "subnet-b225b2f9",
            "cidr": "10.200.128.0/24",
            "availabilityZone": "us-east-1a",
            "routeTableId": "rtb-52b38128"
          },
          {
            "subnetId": "subnet-48478815",
            "cidr": "10.200.129.0/24",
            "availabilityZone": "us-east-1b",
            "routeTableId": "rtb-52b38128"
          }
        ]
      }
    ]
  },
  "hosted-zone:account=xxxxxxxxxxxx:domainName=example.com:region=us-east-1": {
    "Id": "/hostedzone/ZT2IZMVV4BYC3",
    "Name": "example.com."
  }
}

changed account and domain name.

@konstantinj
Copy link
Author

ah I can clarify myself. The setting that's needed in cdk.json is this:

cdk.json

   "context": {
   	"@aws-cdk/core:enableStackNameDuplicates": true
   }

But after a call to cdk this information gets moved to cdk.context.json like this:

cdk.context.json

"@aws-cdk/core:enableStackNameDuplicates": true

Unfortunately the setting in the cdk.json gets removed on acall to cdkand if one does not commit the context json, this setting is lost.

Is it good practise to commit the context.json? I thought not.

@eladb
Copy link
Contributor

eladb commented Jan 16, 2020

It is a good practice as described here:
https://docs.aws.amazon.com/cdk/latest/guide/context.html

Closing...

@eladb
Copy link
Contributor

eladb commented Jan 16, 2020

Just in case: #5834

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants