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 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南