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

Escape hatches: Go Lang Support #31897

Open
2 tasks
toyotest2 opened this issue Oct 25, 2024 · 7 comments
Open
2 tasks

Escape hatches: Go Lang Support #31897

toyotest2 opened this issue Oct 25, 2024 · 7 comments
Labels
@aws-cdk/aws-cloudformation Related to AWS CloudFormation documentation This is a problem with documentation. effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@toyotest2
Copy link

Describe the feature

Request: Escape hatches: Go Lang Support

I could not find any Go language samples in the documentation below.
https://docs.aws.amazon.com/cdk/v2/guide/cfn_layer.html

Additionally, I found the following comments at the workshop.

https://catalog.us-east-1.prod.workshops.aws/workshops/d93fec4c-fb0f-4813-ac90-758cb5527f2f/en-US/walkthrough/go/sample/source-construct/s3-bucket

CDK has a concept called the [escape hatch ](https://docs.aws.amazon.com/cdk/latest/guide/cfn_layer.html)
, which allows you to modify an L2 construct's underlying CFN Resource to access features that are supported by CloudFormation but not yet supported by CDK. Unfortunately, CDK for Go does not yet support this functionality, so we have to create the resource through the L1 construct. See [this GitHub issue ](https://github.com/aws/jsii/issues/2819)
for more information and to follow progress on support for CDK escape hatches in Go.

Use Case

For Customize L2/L3 Constructs in Go Lang.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.162.1

Environment details (OS name and version, etc.)

Cloud9AmazonLinux2023-2024-10-21T21-56

@toyotest2 toyotest2 added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 25, 2024
@github-actions github-actions bot added the @aws-cdk/aws-cloudformation Related to AWS CloudFormation label Oct 25, 2024
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Oct 25, 2024
@khushail khushail self-assigned this Oct 25, 2024
@khushail
Copy link
Contributor

khushail commented Oct 25, 2024

Hi @toyotest2 , thanks for reaching out and linking the related docs available. I found this issue mentioned in the workshop doc which was further fixed by the PR.

Considering the usecase, it would be helpful to have the mentioned support for GO as well. Marking the issue as P2 as L2 constructs are available. P2 would mean it would not be immediately addressed by the team but would be on their radar.

@khushail khushail added p2 effort/medium Medium work item – several days of effort and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Oct 25, 2024
@khushail khushail removed their assignment Oct 25, 2024
@gshpychka
Copy link
Contributor

Although I'm very surprised that missing Go support for L1 would be a P2 issue (considering there's no workaround), L1 resources are fully supported in Go as far as I understand, and escape hatches work with jsii.UnsafeCast. Am I missing something?

@khushail
Copy link
Contributor

khushail commented Nov 1, 2024

Hi @gshpychka , I understand your point of view here. I marked it as P2 as escape hatches are available in other languages and I am not sure supporting this for GO is on the team roadmap.

I would reach out to team on this if they have this in their future action items or something to be considered a priority.

@gshpychka
Copy link
Contributor

I am not sure supporting L1 construct for GO is on the team roadmap.

My understanding is that it's already supported, but I may be missing something.

@khushail
Copy link
Contributor

khushail commented Nov 1, 2024

Let me recheck the docs and get back as I am not very familiar with GO language and the provided support by CDK or cloudformation. Apologies for the confusion there.

@khushail
Copy link
Contributor

khushail commented Nov 1, 2024

Hey @gshpychka , thanks for double checking and sharing your insights here.

The Go constructs and way of usage are very different and I think I got stumped by that, my bad.
It is correct in saying the L1 constructs support as well Escape hatch support is already there, however we need to provide better samples for the GO CDK usage in the docs.

Sharing the CDK GO construct and props ref.

Constructs, which represent one or more AWS resources and their associated attributes, are represented in Go as interfaces

So let me clarify a bit on my earlier statements as per my understanding -

First, CDK has  L2 Construct that allows you to build resources according to best practices by simply specifying a few required values.

L2 constructs are built on L1 construct with abstraction, which allows you to build resources by specifying them in a manner consistent with CloudFormation.

While L2 Construct is convenient and easy to create resources, it also abstracts parameters, so there are some parameters that might not be specified in L2.

Therefore, Escape Hatch come into picture - these provide a way to cast a resource created with L2 Construct to an L1 Construct type and later override the parameters that can only be specified with L1.

but its mentioned in the workshop page -

However, the CDK for Go does not currently support escape hatch according to [the workshop](https://catalog.us-east-1.prod.workshops.aws/workshops/d93fec4c-fb0f-4813-ac90-758cb5527f2f/en-US/walkthrough/go/sample/source-construct/s3-bucket).

which seems confusing but the issue mentioned in above workshop also seems to be resolved and implemented.
Also given that PR and its implementation , it makes sense to have its support by jsii.UnsafeCast (though it might not be applicable in every service parameter scenario).
I found an article on Escape hatch support for CDK GO, please feel free to check this out - https://www.go-on-aws.com/infrastructure-as-go/cdk-go/escape-hatches/

So in a nutshell. yes Escape hatches are there.

and here is a complete Dev guide of CDK with GO language for the reference - https://pkg.go.dev/github.com/aws/aws-cdk-go/awscdk/v2

@khushail
Copy link
Contributor

khushail commented Nov 1, 2024

@toyotest2 , as better examples could be provided in case of GO CDK, I would submit the page feedback which is located on the top right corner. And also adding documentation label to this issue.

@gshpychka , hope that makes sense! Thanks for the correction!

@khushail khushail added the documentation This is a problem with documentation. label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cloudformation Related to AWS CloudFormation documentation This is a problem with documentation. effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

3 participants