Creating a stackset with cloudformation TO DEPLOY STACK IN MY MEMBERS ACCOUNT

0

Hello, Pls i need help with sample cloudformation code on how to deploy a stack set with cloudformation i keep getinng this error below, will really appreciate a correct code and the reason i was haveing error and what i was getting wrong

ERROR Properties validation failed for resource TestingStackSet20240411 with message: #: #: only 1 subschema matches out of 2 #/StackInstancesGroup/0: required key [DeploymentTargets] not found #/StackInstancesGroup/0: required key [Regions] not found #/StackInstancesGroup/0: extraneous key [StackInstances] is not permitted

CODE

  TestingStackSet20240411:
    Type: AWS::CloudFormation::StackSet
    Properties:
      StackSetName: TestingStackSet20240411
      TemplateURL: https://s3.amazonaws.com/<your-bucket>/StackSetTemplate.yaml
      Parameters:
      - {ParameterKey: BucketName, ParameterValue: TestingBucketName}
      # Tags: #[Array of Tag]
      Capabilities: #[Array of String]
      - CAPABILITY_NAMED_IAM
      PermissionModel: SELF_MANAGED #Allowed Values[SERVICE_MANAGED | SELF_MANAGED]
      AutoDeployment:
        # Describes whether StackSets automatically deploys to AWS Organizations accounts that are added to a target organizational unit
        Enabled: false
        RetainStacksOnAccountRemoval: false
      # StackInstancesGroup: #[Array of StackInstances]
      StackInstances:
      - DeploymentTargets:
          # AccountFilterType: #Allowed Values[NONE | UNION | INTERSECTION | DIFFERENCE]
          # OrganizationalUnitIds: #[Array of String]
          # AccountsUrl: [String]
          Accounts: #[Array of String]
          - !GetAtt TestingOUAccount20240411.AccountId #!RefTestingOUAccount20240411
          Regions: #[Array of String]
          - us-east-1
        ParameterOverrides: #[Array of Parameter]
        - {ParameterKey: BucketName, ParameterValue: TestingBucketName,}
Nafiu
已提问 1 个月前227 查看次数
1 回答
2
已接受的回答

Hello.

I think the problem is that the list is created by listing something called "StackInstances" that cannot be used in "StackInstancesGroup".
Also, "Regions" was written to be included in "DeploymentTargets", so that has also been corrected.
So I think you can use it by modifying it as follows.
https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-resource-cloudformation-stackset.html#cfn-cloudformation-stackset-stackinstancesgroup

  TestingStackSet20240411:
    Type: AWS::CloudFormation::StackSet
    Properties:
      StackSetName: TestingStackSet20240411
      TemplateURL: https://s3.amazonaws.com/<your-bucket>/StackSetTemplate.yaml
      Parameters:
      - {ParameterKey: BucketName, ParameterValue: TestingBucketName}
      # Tags: #[Array of Tag]
      Capabilities: #[Array of String]
      - CAPABILITY_NAMED_IAM
      PermissionModel: SELF_MANAGED #Allowed Values[SERVICE_MANAGED | SELF_MANAGED]
      AutoDeployment:
        # Describes whether StackSets automatically deploys to AWS Organizations accounts that are added to a target organizational unit
        Enabled: false
        RetainStacksOnAccountRemoval: false
      StackInstancesGroup:
        - DeploymentTargets:
            # AccountFilterType: #Allowed Values[NONE | UNION | INTERSECTION | DIFFERENCE]
            # OrganizationalUnitIds: #[Array of String]
            # AccountsUrl: [String]
            Accounts: #[Array of String]
              - !GetAtt TestingOUAccount20240411.AccountId #!RefTestingOUAccount20240411
          Regions: 
            - us-east-1
        ParameterOverrides: #[Array of Parameter]
        - {ParameterKey: BucketName, ParameterValue: TestingBucketName,}
profile picture
专家
已回答 1 个月前
profile picture
专家
已审核 6 天前
profile picture
专家
已审核 1 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则