aws / aws/aws-toolkit-vscode

AvailabilityZone parameters array marked as invalid

Open
#2,809 2 comments 0 reactions 0 assignees View on GitHub
aws-documents aws-documents-sam-cfn blocked bug
Dominant language
TypeScript
Stars
2k
Forks
807
Avg merge
10h 12m
Merged PRs (30d)
7

Description

Getting `Incorrect type. Expected "string".` for the parameter `[ 0, !GetAZs '' ]` in the following:

```PrivateSubnet1a:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref VPC
AvailabilityZone: !Select [ 0, !GetAZs '' ]
CidrBlock: !Ref PrivateSubnetRange1a
MapPublicIpOnLaunch: false
Tags:
- Key: Name
Value: !Sub ${EnvironmentName}-1a-private
```

The template works fine and creates the VPC and subnets as expected. The issue is the AWS Toolkit extension is marking the parameter as incorrect even though it is valid syntax.

I discovered that when the file first loads in VS Code, there are highlighted syntax errors throughout the template (the Amazon dynamic variables) and after the AWS Toolkit extension loads all of the syntax errors clear. After making any edit to the CloutFormation template, the segment in question becomes marked as invalid again.

- OS: MacOS 12.5
- Visual Studio Code version: 1.70.0
- AWS Toolkit version: 1.46.0

Contributor guide

Open the contributing guide

Research direction

Reproduce the diagnostic in VS Code 1.70.0 with AWS Toolkit 1.46.0 using the CloudFormation template shown, then edit the template and observe the AvailabilityZone parameter. Trace why `[ 0, !GetAZs '' ]` is reported as a string-type error while valid templates load successfully; done when the false diagnostic no longer returns after edits.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript, vscode
Domain
cloud, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.