Skip to content

Can´t create TAG specification for EC2 instance #391

@PetrMa

Description

@PetrMa

Describe the bug

I have AWS.Tools 5.0.17 installed on Windows computer

this script:
Import-Module -Name AWS.Tools.EC2
$tag = New-Object Amazon.EC2.Model.Tag
$tag.Key = "Name"
$tag.Value = "MyEC2Instance"
$tagSpec = New-Object Amazon.EC2.Model.TagSpecification
$tagSpec.ResourceType = "instance"
$tagSpec.Tags.Add($tag)

ends with an error:
InvalidOperation: You cannot call a method on a null-valued expression.

In version 4.1.xxx it works fine.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Create a TAG specificatio

Current Behavior

InvalidOperation: You cannot call a method on a null-valued expression

Reproduction Steps

Import-Module -Name AWS.Tools.EC2
$tag = New-Object Amazon.EC2.Model.Tag
$tag.Key = "Name"
$tag.Value = "MyEC2Instance"
$tagSpec = New-Object Amazon.EC2.Model.TagSpecification
$tagSpec.ResourceType = "instance"
$tagSpec.Tags.Add($tag)

Possible Solution

No response

Additional Information/Context

No response

AWS Tools for PowerShell version used

5.0.17

PowerShell version used

the same issue for 5.1 and 7.5.2

Operating System and version

Windows Server 2022

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.module/powershell-cmdletsp3This is a minor priority issueresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions