-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Handling AWS::NoValue in Api resources #1435
Comments
Any progress with this? Is there a workaround other that manually setting the domain name and certificate in the AWS console for those you want it? |
I think the same is true for Auth / ResourcePolicy as well. |
I tried this every way I could think of:
We ended up needing to add a (manual or scripted) pre-deploy step that just removes the entire Domain config part if a domain isn't desired. I'd love to see a way to conditionally set a domain on an API. |
Thanks a lot guys. I was able to reproduce the issue. the problem is in this peace of code. We raise an exception if the I'm labeling this for internal review as this is a common issue affecting many other areas as well. |
I believe the error extends beyond just AWS::NoValue. I am trying to conditionally set the Domain configuration to support a Gov Cloud deployment and get the same error despite each option in the condition containing the
That yields the same error above:
|
Hi, is there any new on this? I am writing a SAM template, and am forced to define three
Ideally I would like to define a single resource and conditionally add a |
Unfortunately, no progress I'm aware of at the time. Conditionally defining |
Hi @elbayaaa I am curious how you are able to conditionally define multiple |
Having the same issue when defining conditional domains. Any workaround? |
Having a similar issue as holt-cader trying to define conditional EndpointConfiguration. Intrinsic functions do not work inside Domain per AWS support. Hoping this gets resolved. """In the above snippet you are using “EndpointConfiguration” which further holds the condition under “DomainName” . Domain property was unable to to accept value through Intrinsic Function ’If' and from the testing I have performed It seems there is no issue with your template but this feature is not being supported by AWS till now."""
"FAILED" Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [FormApiGateway] is invalid. EndpointConfiguration for Custom Domains must be one of ['EDGE', 'REGIONAL', 'PRIVATE']." |
I thought I found a work-around but actually found another bug. I created 2 APIs so the entire API definition was dependent on my condition. Unfortunately, the following fails validation with sam validate:
Here is the error:
|
I faced the same problem for an HTTP API and found a work-around which seems to be fine: set the custom domain using "native" CloudFormation resources in place of SAM "Domain" attribute. I don't know if something similar can also work for REST APIs, I post it here anyway as this topic appears to be the most related to my problem. Resources:
Api:
Type: AWS::Serverless::HttpApi
# put any necessary properties excluding the domain
ApiDomain:
Type: AWS::ApiGatewayV2::DomainName
Condition: HasDomainName
Properties:
DomainName: !Ref DomainName
DomainNameConfigurations:
- CertificateArn: !Ref DomainCertificateArn
ApiDomainMapping:
Type: AWS::ApiGatewayV2::ApiMapping
Condition: HasDomainName
Properties:
ApiId: !Ref Api
Stage: $default # unless a different StageName is used in Api
DomainName: !Ref ApiDomain |
You might be able to get this to work by adding Transform:
- AWS::LanguageExtensions
- AWS::Serverless-2016-10-31
See #2533 for more information. |
Closing in favor of #2533. |
Description:
I was hoping to make use of the new
Domain
property on Api resources, but conditionally based on a template parameter. Attempting to set theDomain
to!Ref AWS::NoValue
(for the case where noDomainName
is desired) fails with a message that suggests it's not removing theDomain
property and is expecting real configuration in it. Here's what I tried in theApi
configuration:And the message I got:
Steps to reproduce the issue:
AWS::Serverless::Api
resource withDomain
property specified as in above example withHasDomainName
condition (evaluating to false).Observed result:
Deploy fails with message: "Custom Domains only works if both DomainName and CertificateArn are provided"
Expected result:
DomainName
andBasePathMapping
resources created as if I had applied the conditional on each of them, such as:The text was updated successfully, but these errors were encountered: