Skip to content
This repository has been archived by the owner on Dec 28, 2019. It is now read-only.

rename refactor works but not as expected #88

Open
sdole opened this issue Apr 12, 2017 · 2 comments
Open

rename refactor works but not as expected #88

sdole opened this issue Apr 12, 2017 · 2 comments

Comments

@sdole
Copy link

sdole commented Apr 12, 2017

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.

@edthorne
Copy link
Contributor

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.

@bamapookie
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants