[aws-rds] Availability Zone parameter silently removed from stack when MultiAZ is true
See original GitHub issueIf you have a DB instance created with the availability_zone
parameter setted and also set multi_az
parameter to true
then CDK simply generates the CloudFormation template removing the availability_zone
setting because, both parameters cannot be used at the same time.
The issue is that the developer doesn’t have any visibility on that, so suppose that later in another deploy multi_az
is setted to false
, then CDK will consider the availability_zone
parameter and probably try to make a DB instance replacement due to an AZ change.
Reproduction Steps
#!/usr/bin/env python3
from aws_cdk import core
from aws_cdk import (
aws_ec2 as ec2,
aws_rds as rds,
core
)
class Cdk167RdsStack(core.Stack):
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
vpc = ec2.Vpc.from_lookup(
self,
"vpc",
vpc_id="vpc-xxxxxxxxxxx"
)
rds.DatabaseInstance(
self,
'DBInstance',
engine=rds.DatabaseInstanceEngine.postgres(
version=rds.PostgresEngineVersion.of(
postgres_full_version="12.3",
postgres_major_version="12"
)
),
vpc=vpc,
availability_zone=vpc.availability_zones[0],
multi_az=False,
)
app = core.App()
Cdk167RdsStack(app, "cdk-1-67-rds", env={'region': 'eu-west-1', 'account': 'XXXXXXXXXXXX'})
app.synth()
Then change multi_az
to True
and synth again.
What did you expect to happen?
If both parameters are setted at the same time, there must be some kind of exception (IncompatibleParameters or something like that) or at least a warning before apply the change.
What actually happened?
No warning or exception is shown to the developer, so he/she cannot be aware about the removal of availability_zone
from CloudFormation output template when multi_az
is True
.
Environment
- CLI Version : aws-cli/1.18.115 Python/3.8.5 Darwin/19.6.0 botocore/1.17.38 CDK -> 1.67
- Framework Version: 1.67
- Node.js Version: v14.7
- OS : macos 10.15.7
- Language (Version): Python (3.8.5)
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)
Top GitHub Comments
Hi Adam,
Thanks for your response. Now I have more free time for it, so even if Typescript is not my primary programming language, I will try it 😄
⚠️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.