Open sdole opened 7 years ago
If you're using the shorthand function syntax like so:
VolumeId: !Ref ApplicationDataVolume
The refactor results in:
VolumeId: "RenamedResource"
The shorthand function reference is lost during refactoring.
I have encountered this as well with the current version (0.6.11). In addition, References in a !Sub
function are not replaced. Here is a small example:
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
OldName:
Type: String
Resources:
Resource:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: sample.yaml
Parameters:
SampleRef:
Ref: OldName
SampleShorthandRef: !Ref OldName
SampleSub: !Sub ${OldName}
Renaming OldName
to NewName
, one would expect
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
NewName:
Type: String
Resources:
Resource:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: sample.yaml
Parameters:
SampleRef:
Ref: NewName
SampleShorthandRef: !Ref NewName
SampleSub: !Sub ${NewName}
But instead, you get the following
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
NewName:
Type: String
Resources:
Resource:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: sample.yaml
Parameters:
SampleRef:
Ref: "NewName" // Invalid quotes
SampleShorthandRef: "NewName" // Missing !Ref and invalid quotes
SampleSub: !Sub ${OldName} // No replacement
I have a property like so:
VolumeId: Ref: ApplicationDataVolume
ApplicationDataVoume
is a resource.When I refactor ApplicationDataVolume with shift F6 key combo, it renames the resource, but the ref is renamed as so:
VolumeId: Ref: "RenamedResource"
Those double quotes are not needed.