def generate_sample_cfn_module(env_root, module_dir=None):
    """Generate skeleton CloudFormation sample module."""
    if module_dir is None:
        module_dir = os.path.join(env_root, 'sampleapp.cfn')
    generate_sample_module(module_dir)
    for i in ['stacks.yaml', 'dev-us-east-1.env']:
        shutil.copyfile(
            os.path.join(ROOT,
                         'templates',
                         'cfn',
                         i),
            os.path.join(module_dir, i)
        )
    os.mkdir(os.path.join(module_dir, 'templates'))
    with open(os.path.join(module_dir,
                           'templates',
                           'tf_state.yml'), 'w') as stream:
        stream.write(
            cfn_flip.flip(
                check_output(
                    [sys.executable,
                     os.path.join(ROOT,
                                  'templates',
                                  'stacker',
                                  'tfstate_blueprints',
                                  'tf_state.py')]
                )

            )
        )
    LOGGER.info("Sample CloudFormation module created at %s",
                module_dir)
def generate_sample_cfn_module ( env_root , module_dir = None ) : if module_dir is None : module_dir = os . path . join ( env_root , 'sampleapp.cfn' ) generate_sample_module ( module_dir ) for i in [ 'stacks.yaml' , 'dev-us-east-1.env' ] : shutil . copyfile ( os . path . join ( ROOT , 'templates' , 'cfn' , i ) , os . path . join ( module_dir , i ) ) os . mkdir ( os . path . join ( module_dir , 'templates' ) ) with open ( os . path . join ( module_dir , 'templates' , 'tf_state.yml' ) , 'w' ) as stream : stream . write ( cfn_flip . flip ( check_output ( [ sys . executable , os . path . join ( ROOT , 'templates' , 'stacker' , 'tfstate_blueprints' , 'tf_state.py' ) ] ) ) ) LOGGER . info ( "Sample CloudFormation module created at %s" , module_dir )
Generate skeleton CloudFormation sample module.