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

Can't use create SSM Association with SSM Document Parameters #90

Open
stuhay opened this issue Dec 14, 2021 · 2 comments
Open

Can't use create SSM Association with SSM Document Parameters #90

stuhay opened this issue Dec 14, 2021 · 2 comments

Comments

@stuhay
Copy link

stuhay commented Dec 14, 2021

I seem to be unable to use SSM Document Parameters in an SSM Association

Trying to get vaporshell to output the parameter on an SSM association as follows, which is known to work within Cloudformation

  ssmAssoc1:
    Type: AWS::SSM::Association
    Properties:
      InstanceId: !Ref "Ec2InstanceLinCen101"
      Parameters:
        Hostname:
          - sss

Running the raw command:
New-VSSSMAssociation -InstanceId 'i-xxxxxxxxxxxxxx' -LogicalId ssmAssoc1 -Name stuart -Parameters @{ Hostname = @('sss') } -verbose

which results in this ERROR:
New-VSSSMAssociation: This parameter only accepts the following types: Vaporshell.Resource.SSM.Association.ParameterValues. The current types of the value are: System.Collections.Hashtable, System.Object.

So I try ParameterValues as per https://vaporshell.io/docs/glossary/Add-VSSSMAssociationParameterValues

New-VSSSMAssociation -InstanceId 'i-xxxxxxxxxxxxxx' -LogicalId ssmAssoc1 -Name stuart -Parameters ( Add-VSSSMAssociationParameterValues -ParameterValues @{ Hostname = @('sss') } ) -verbose
And it adds an extra level called ParamterValues

VERBOSE: Resulting JSON from New-VaporResource:

{
  "ssmAssoc1": {
    "Type": "AWS::SSM::Association",
    "Properties": {
      "InstanceId": "i-xxxxxxxxxxxxxx",
      "Name": "stuart",
      "Parameters": {
        "ParameterValues": {
          "Hostname": [
            "sss"
          ]
        }
      }
    }
  }
}

Which if I run in the resulting template, it fails to create because "ParameterValues" is not a parameter

Resource handler returned message: "Invalid request provided: Parameter "ParameterValues" is not defined in the document.

Have tried different variations ParameterValues doesn't give the result that will allow the template to work.

Is there a bug here, or am I just doing something wrong ?

@stuhay
Copy link
Author

stuhay commented Dec 14, 2021

Interestingly, the documentation for for ParameterValues has a dead link:
https://vaporshell.io/docs/glossary/Add-VSSSMAssociationParameterValues

PARAMETERS
-PARAMETERVALUES
The parameters for the runtime configuration of the document.

Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-parametervalues.html#cfn-ssm-association-parametervalues-parametervalues

The URL listed there doesn't arrive at any page, and I am struggling to find any documentation relating to parametervalues in AWS

@stuhay
Copy link
Author

stuhay commented Jan 10, 2022

So on further investigation, I have discovered that ParameterValues for SSM Associations are no longer part of the AWS Spec.

Simply by rebuilding the existing code in main, it now correctly builds New-VSSSMAssociation function to allow for a hash to be passed instead of parameterValue.

I have done this in a private fork and it works nicely. What is needed to get a new build of the module from your Repo?

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

1 participant