def __init__( self, name: str, description: str, regions: list[str], ous: Optional[list[str]] = None, accounts: Optional[list[str]] = None, failure_tolerance_count: int = 0, max_concurrent_count: int = 1, ): """Initialize a CloudFormation service managed stack set. :param name: stack set name :param description: stack set description :param regions: list of regions where to deploy stack set stack instances :param ous: OrganizationalUnitIds for which to create stack instances in the specified Regions. Note that if both ous and accounts parameters are None then the stack set is deployed into the whole organisation :param accounts: list of accounts where to deploy stack set stack instances :param failure_tolerance_count: The number of accounts, per Region, for which the stackset deployment operation can fail before AWS CloudFormation stops the operation in that region :param max_conccurent_count: The maximum number of accounts in which to perform stackset deployment operations at one time. It is at most one more than the FailureToleranceCount. """ self.name = name self.description = description self.stack = Stack(stack_name=f"{self.name}-stack", cfn_role_arn="stackset") self.template_filename = f"{self.name}-template.yaml" self.regions = regions self.ous = ous self.accounts = accounts self.operation_preferences = cloudformation.OperationPreferences( FailureToleranceCount=failure_tolerance_count, MaxConcurrentCount=max_concurrent_count, )
def __init__( self, name: str, description: str, regions: list[str], ous: Optional[list[str]] = None, ): """Initialize a CloudFormation service managed stack set. :param name: stack set name :param description: stack set description :param regions: list of regions where to deploy stack set stack instances :param ous: OrganizationalUnitIds for which to create stack instances in the specified Regions. """ self.name = name self.description = description self.stack = Stack(stack_name=f"{self.name}-stack", cfn_role_arn="stackset") self.template_filename = f"{self.name}-template.yaml" self.regions = regions self.organizational_units = ous
def stack() -> Stack: """Stack fixture to help dumping dictionnaries from constructs.""" return Stack("test-stack", "this is a test stack")
def test_instanciate() -> None: """Test stack instanciation.""" stack = Stack("test-stack", "this is a test stack") assert stack
def test_add_and_get_item() -> None: """Test adding a construct and retrieving an AWSObject from a stack.""" stack = Stack("test-stack", "this is a test stack") stack.add(Bucket("my-bucket")) my_bucket = stack["my-bucket"] assert my_bucket