def test_infra(sess_mock): sess_mock.return_value = True session = BotoSession() infra = Infra('Test', session) vpc_stack = infra.add_stack(vpc.VPCStack()) s3_one = infra.add_stack(s3.S3Stack('one')) s3_two = infra.add_stack(s3.S3Stack('two')) # test find stack vpc_find = infra.find_stack(vpc.VPCStack) assert isinstance(vpc_find, (vpc.VPCStack)) assert infra.find_stack(s3.S3Stack, 'one').stack_name == 'one' assert infra.find_stack(s3.S3Stack, 'two').stack_name == 'two' # test list_stacks assert len(infra.list_stacks()) == 3 # test sub sub = infra.create_sub_infra('sub') sub_sub = sub.create_sub_infra('sub') assert sub_sub.prefix == ['sub', 'sub']
ami.add_role('sudo-nopw', {}, 100) ami.add_role('users', {'githubusers': ['ibejohn818']}, 200) return ami # ANSIBLE PATH Ami.ANSIBLE_DIR = "{}/ansible".format( os.path.dirname(os.path.realpath(__file__))) session = BotoSession(region_name='us-east-2') infra = Infra('NatDemo', session) # create sns topic for alarms # top level sns topic sns_stack = infra.add_stack(sns.SNSTopicStack("AlarmNotifications")) # topic subscriptions ## slack subscription slack_sub = sns_stack.add_subscription(sns.SlackSubscription("AwsAlarms")) ## email subscription email_sub = sns_stack.add_subscription(sns.EmailSubscription('EmailNotify')) infra.add_vars({'InputEmailNotifySNSEmailAddress': '*****@*****.**'}) # add ami's to infra web_ubuntu = web_ubuntu_ami() aws_bastion = aws_bastion_ami() infra.add_image(web_ubuntu) infra.add_image(aws_bastion) prod = prod_stacks(infra)