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

Add a simple test for the new AWS::LanguageExtensions transform #2074

Merged
merged 1 commit into from
Oct 23, 2022

Conversation

michael-k
Copy link
Contributor

See https://aws.amazon.com/about-aws/whats-new/2022/09/aws-cloudformation-new-language-extensions-transform/

I've take the example from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-languageextension-transform.html to see if that works.

At least the combination of AWS::LanguageExtensions with the AWS::Serverless transform and globals needs a bit of work. The globals checks don't work with multiple transforms.

def set_transform(self, transform: Union[List[object], str]) -> None:
from troposphere.serverless import SERVERLESS_TRANSFORM
if self.globals and transform != SERVERLESS_TRANSFORM:
raise ValueError(
"Cannot set transform to non-Serverless while using Globals"
)
self.transform = transform
def set_globals(self, globals: Globals) -> None:
from troposphere.serverless import SERVERLESS_TRANSFORM
if self.transform != SERVERLESS_TRANSFORM:
raise ValueError(
f"Cannot set Globals for non-Serverless template (set transform to '{SERVERLESS_TRANSFORM}' first)"
)
self.globals = globals

@michael-k
Copy link
Contributor Author

The tests passed locally.

The failing spec test is a bit annoying. I've looked into it, but spent most of my available time understanding the code.

@markpeek markpeek merged commit 4bfe333 into cloudtools:main Oct 23, 2022
@markpeek
Copy link
Member

Thanks!

@michael-k michael-k deleted the aws-languageextension-transform branch October 24, 2022 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants