-
Notifications
You must be signed in to change notification settings - Fork 472
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
sam.schema.json: Multiple valid CloudFormation constructs not recognized #1978
Comments
Thanks for the report, and sorry for the trouble! How are you disabling the schema? For reference, the schema is based on https://github.com/awslabs/goformation .
at a glance, it seems like that should be allowed by the schema: https://github.com/awslabs/goformation/blob/master/generate/sam-2016-10-31.json#L114-L131 We will continue to improve the support. Thanks for the concrete examples. |
Just for clarification: the above file isn't the schema, but is used instead to define |
Thanks for the prompt reply. I disabled validation globally, in Settings > YAML > Disable validation. I should have said disable validation, not disable the schema... though I believe you can tell the language server to override the schema for a specific file by using the My reading of https://github.com/awslabs/goformation/blob/master/generate/sam-2016-10-31.json#L1321 is that |
At least one element is an open issue in the goformation repository: It has been open since March 25, 2021. |
+1 Few more examples we're having: Resources:
ParentCert:
Type: AWS::CertificateManager::Certificate
Properties:
DomainName:
Fn::Sub: # <--- Incorrect type. Expected "string". yaml-schema: aws://sam.schema.json
- "*.${LowerCaseEnv}.${DomainBase}"
- LowerCaseEnv:
Fn::Transform:
Name: "String"
Parameters:
InputString: !Ref ParamEnvironment
Operation: Lower Resources:
AWSOpenSearch:
Type: AWS::OpenSearchService::Domain
Properties:
ClusterConfig:
DedicatedMasterEnabled: false
InstanceType:
Fn::If: # <--- Incorrect type. Expected "string". yaml-schema: aws://sam.schema.json
- ProdLikeSetup
- r6g.large.search
- t3.small.search Resources:
UpdateIpoolCustom:
Type: Custom::UpdateIpool
DependsOn: AWSOpenSearch # <--- Property DependsOn is not allowed. yaml-schema: aws://sam.schema.json
Properties:
ServiceToken: !GetAtt UpdateIpoolFn.Arn
IPoolId: !Ref IPoolOpenSearch Desktop (please complete the following information): |
One I ran into:
Passes 'sam validate' and appears to deploy with the correct ARN for 'Queue'. Desktop (please complete the following information):
|
I just ran into this same issue - number parameter is showing a syntax highlighting error if I set min/max/default to integers. If I convert the values to strings, the resource I'm trying to create complains that it needs a number. |
It looks like a |
I have discovered 3 of these today.
Desktop (please complete the following information): |
Thank you for the reports! In order to keep things manageable, it will help to open new issues for each particular missing field. |
Since AWS Toolkit 1.65 (which includes #3163 ), we now use the full schema provided by the SAM team. If any of the problems reported here is still an issue, please let us know the specific case (and ideally, in a new issue). Thanks! |
Describe the bug
Many advanced CloudFormation features are not currently recognized by the
sam.schema.json
JSON schema. This makes the AWS Toolkit unusable without disabling the YAML schema.See details of issues below.
Number Parameter types should allow numeric defaults
If a parameter is type Number, CloudFormation accepts a numeric default value.
Functions in
Conditions
blockRich nested functional expressions (most using arrays) need to be supported in the condition block. It is currently only supports one level of
object
type.Resource-Level Conditions
All resources can have a string-valued
Condition: <condition-id>
property.String Valued Expressions
Functional expressions that evaluate to a string should be supported for all string-valued properties.
Deep
Fn::Transform
OperatorsThe CloudFormation specification allows inserting a
Fn::Transform
operation at arbitrary places within the template hierarchy. This is the equivalent of every object allowing additionalProperties ofFn::Transform
, instead of simplyfalse
.Custom Resources
Custom CloudFormation resources should be supported, as defined by any resource type starting with
Custom::
prefix. These should require aServiceToken
property, but allow arbitrary additional properties.IAMPolicyDocument
type is missingVersion
propertyHand-coded IAM policies do not work... the policy schema type allows only the
Statement
property, without the (required)Version
property. This causes the anyOf operator to fall back to expecting a string.To Reproduce
Create a CloudFormation template with any of the above constructs.
Expected behavior
All valid CloudFormation syntax would be correctly recognized. The examples above should not produce any of the marked errors.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: