Skip to content
This repository has been archived by the owner on Oct 21, 2023. It is now read-only.

$Tags of Type String when using New-VSStack or Update-VSStack #41

Closed
NikitaGor opened this issue Nov 20, 2018 · 11 comments
Closed

$Tags of Type String when using New-VSStack or Update-VSStack #41

NikitaGor opened this issue Nov 20, 2018 · 11 comments
Assignees
Labels

Comments

@NikitaGor
Copy link

Hi Nate,

when trying to supply tags to New-VSStack or Update-VSStack it fails because the expected type is string.
Was able to solve this one by changing the expected type to
[System.Collections.Generic.List[Amazon.CloudFormation.Model.Tag]]

as per
https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/CloudFormation/TCreateStackRequest.html
https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/CloudFormation/TUpdateStackRequest.html

@scrthq scrthq self-assigned this Nov 20, 2018
@scrthq
Copy link
Member

scrthq commented Nov 20, 2018

Hey @NikitaGor - Thanks for reporting the issue! Checking it out! If possible, can you send the error text you're seeing and what you did to work around it?

Cheers!

  • Nate

@scrthq
Copy link
Member

scrthq commented Nov 20, 2018

Haha, alright, seeing the issue now. No worries on sending the error over, this should be an easy one to fix. I'm on it!

@scrthq
Copy link
Member

scrthq commented Nov 20, 2018

FYI - I know your fix was to supply the expected data type for the request, but I ideally would like to keep this cleaner from a user experience perspective (and not everyone really knows how to deal with Generic Lists that uses PowerShell). Going to change the type to a hashtable so you can feed it something simple and let the function logic do the conversion. Should have a new version pushed up shortly with the fixes!

@NikitaGor
Copy link
Author

Thanks a lot Nate!

@scrthq scrthq closed this as completed in ec825a0 Nov 20, 2018
@ghost ghost removed the review label Nov 20, 2018
@scrthq scrthq reopened this Nov 20, 2018
@scrthq
Copy link
Member

scrthq commented Nov 20, 2018

@NikitaGor You bet! FYI - master branch is building now in Azure Pipelines with the fix to be deployed at the end of it. Keeping this issue open until I get the all clear from you that everything is working fluidly for you. I'll respond here once it's available on the PS Gallery! Should be about 5 minutes.

@scrthq scrthq added the bug label Nov 20, 2018
@scrthq
Copy link
Member

scrthq commented Nov 20, 2018

v2.6.1 is now available on the PSGallery! Update and let me know how it works for you!

Usage:

$tags = @{
    Name        = "WebServerStack"
    Role        = "Web"
    Environment = "Production"
}
New-VSStack -Tags $tags

@NikitaGor
Copy link
Author

Confirming everything works as expected now. Thank you very much.
On a side note: I believe you accidentally took out this bit of code from Update-VSStack.ps1 which results in removing that tag from AWS resources since it's no longer supplied


if ($PSBoundParameters.Keys -contains "Tags") {	
            $PSBoundParameters["Tags"] += (VSStackTag BuiltWith VaporShell)	
        }	
        else {	
            $PSBoundParameters["Tags"] = (VSStackTag BuiltWith VaporShell)	
        }

@scrthq
Copy link
Member

scrthq commented Nov 20, 2018

@NikitaGor - No problem! Thank you for confirming!

I did remove that piece to prevent replacing all Tags with just that one when the stack is updated without specifying new tags (i.e. because you don't need to update Tags). Good catch on the fact that it removes it when a new tag list is provided with the Stack update request. I can add it back in ASAP if it's something you leverage, otherwise I will get it sorted within the next few days! Thoughts?

@NikitaGor
Copy link
Author

No problem from my end at all! Thank you once again.
Feel free to close this one off. Cheers.

@scrthq
Copy link
Member

scrthq commented Nov 20, 2018

Cool! Going to keep this open until I close that gap.

Thanks again for reporting the bug!

scrthq added a commit that referenced this issue Nov 26, 2018
…ons up-to-spec

## 2.6.2

* [Issue #41](#41)
  * Fixed: `Update-VSStack` and `Update-VSStackSet` were removing the `BuiltWith = VaporShell` tags if not explicitly included when updating Tags.
* Miscellaneous
  * Brought Resource Type and Property Type functions up to current spec sheet.
@scrthq
Copy link
Member

scrthq commented Nov 26, 2018

All wrapped up in v2.6.2. Closing this out, thanks again, @NikitaGor !

@scrthq scrthq closed this as completed Nov 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants