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
demandé il y a un mois226 vues
1 réponse
2
Réponse acceptée

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
EXPERT
répondu il y a un mois
profile picture
EXPERT
vérifié il y a 6 jours
profile picture
EXPERT
vérifié il y a un mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions