skip to Main Content

I’m using service managed permission to create_stack_instances for an OU, filtered by intersection of a list of accounts and when i run the command, it gives me an error, Can someone please tell me what’s wrong with my code here?

  1. error via cli

    Parameter validation failed:
    Unknown parameter in DeploymentTargets: "AccountFilterType", must be one of: Accounts, AccountsUrl, OrganizationalUnitIds

  2. error via lambda

    [ERROR] ParamValidationError: Parameter validation failed:
    Unknown parameter in DeploymentTargets: "AccountFilterType", must be one of: Accounts, AccountsUrl, OrganizationalUnitIds

  3. lambda code:

    def add_stack_to_stackset(StackSetName, accountid):

     response = CF.create_stack_instances(
         StackSetName=StackSetName,
         DeploymentTargets={
             'OrganizationalUnitIds': ['ou-blah'],
              'Accounts': [accountid],
             'AccountFilterType': 'INTERSECTION'
         },
         Regions=['us-east-1']
     )
     op_id = response['OperationId']
     return op_id
    
  4. cli code

    aws cloudformation create-stack-instances –stack-set-name demo –deployment-targets OrganizationalUnitIds=ou-blah,Accounts=12345,AccountFilterType=INTERSECTION –regions us-east-1

2

Answers


  1. Sometimes ValidationErrors are just bugs or occur when you are using an old version of boto3 – for example, in the newest version of boto3 INTERSECTION is a valid parameter (if you are using this version then it is a bug…).

    You can always disable request validation:

    parameter_validation

    Disable parameter validation (default is true,
    parameters are validated). This is a Boolean value that is either true
    or false. Whenever you make an API call using a client, the parameters
    you provide are run through a set of validation checks, including (but
    not limited to) required parameters provided, type checking, no
    unknown parameters, minimum length checks, and so on. Typically, you
    should leave parameter validation enabled.

    Login or Signup to reply.
  2. I had similar issue, but with aws cli. Upgrading to aws cli v2 resolved it. So I’d suspect the same problem with boto3. Using latest version should get this working.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search