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

Elasticache.CfnParameterGroup cannot be initialized with a parameter_group_name #8180

Closed
tonyhammainen opened this issue May 25, 2020 · 3 comments
Assignees
Labels
@aws-cdk/aws-elasticache Related to Amazon ElastiCache bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed.

Comments

@tonyhammainen
Copy link

tonyhammainen commented May 25, 2020

I wanted to initialize an Elasticache.CfnCacheCluster with a specific Elasticache.CfnParameterGroup. Elasticache.CfnCacheCluster has an optional init parameter called cache_parameter_group_name. However, Elasticache.CfnParameterGroup does not allow defining its name in its initialization. Furthermore, it does not have an attribute called parameter_group_name, which would be intuitive.

Not being able to define parameter_group_name results in having a gibberish name visible in AWS Console under the view: Elasticache > Parameter Groups.

It also makes the initialization of Elasticache.CfnCacheCluster with a Elasticache.CfnParameterGroup very unintuitive.

Reproduction Steps


redis_parameter_group = elasticache.CfnParameterGroup(
    self,
    "RedisParameterGroup",
    description="Redis parameter group for ...",
    cache_parameter_group_family="redis5.0",
    properties={ },
)

redis_subnet_group = elasticache.CfnSubnetGroup(
    self,
    "RedisClusterPrivateSubnetGroup",
    cache_subnet_group_name="redis-subnet-group",
    description="Redis subnet for ...",
    subnet_ids=[subnet.subnet_id for subnet in vpc.private_subnets],
)

self.redis = elasticache.CfnCacheCluster(
    self,
    "RedisCacheCluster",
    engine="redis",
    cache_node_type="cache.r5.xlarge",
    num_cache_nodes=1,
    cluster_name="redis",
    vpc_security_group_ids=[self.redis_security_group.security_group_id],
    cache_subnet_group_name=redis_subnet_group.cache_subnet_group_name,
    cache_parameter_group_name=redis_parameter_group.????????,
)

Workaround for inputting into CfnCacheCluster:

One needs to figure out that .ref resolves to the name

ref | string | Return a string that will be resolved to a CloudFormation { Ref } for this element.
-- | -- | --

Which with further digging resolves to

Return Values
Ref
When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the resource name.

so
cache_parameter_group_name=redis_parameter_group.ref
works

Environment

  • CLI Version : 1.32.2 (build e19e206)
  • Framework Version:
  • OS : MacOS Catalina
  • Language : Python

Suggestion

Elasticache.CfnParameterGroup should take parameter_group_name in its initialization, and it should be a callable attribute.


This is 🐛 Bug Report

@tonyhammainen tonyhammainen added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 25, 2020
@SomayaB SomayaB added the @aws-cdk/aws-elasticache Related to Amazon ElastiCache label May 27, 2020
@iliapolo iliapolo added needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. effort/small Small work item – less than a day of effort labels May 27, 2020
@iliapolo
Copy link
Contributor

Hi @tonyhammainen

It seems the configuring the group name isn't supported by CloudFormation.

See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-parameter-group.html

Regarding your suggestion:

Elasticache.CfnParameterGroup should take parameter_group_name in its initialization, and it should be a callable attribute.

While this intuitively makes sense, all the Cfn* resources are actually auto-generated from the CloudFormation spec, so as long as its not supported, the Cfn* will remain the same.

To that end, I suggest you also open a feature request for CloudFormation.

In the meantime, we have an issue for implementing higher level constructs in the aws-elasticache module, where you can keep track of possibly a native CDK workaround for this issue.

@tonyhammainen
Copy link
Author

Thanks for the speedy reply!

Opened a CFN feature request: aws-cloudformation/cloudformation-coverage-roadmap#484

Wishing to see a higher level construct soon!

@github-actions
Copy link

github-actions bot commented Jun 3, 2021

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jun 3, 2021
@github-actions github-actions bot closed this as completed Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-elasticache Related to Amazon ElastiCache bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed.
Projects
None yet
Development

No branches or pull requests

3 participants