MCPcopy Create free account
hub / github.com/airbnb/binaryalert / _write_config

Method _write_config

tests/cli/_common.py:34–54  ·  view source on GitHub ↗

Create terraform.tfvars file with the given configuration values.

(
            account_id: str = '123412341234',
            region: str = 'us-test-1',
            prefix: str = 'test_prefix',
            enable_downloader: bool = True,
            cb_url: str = 'https://cb-example.com',
            encrypted_api_token: str = 'A'*100)

Source from the content-addressed store, hash-verified

32
33 @staticmethod
34 def _write_config(
35 account_id: str = '123412341234',
36 region: str = 'us-test-1',
37 prefix: str = 'test_prefix',
38 enable_downloader: bool = True,
39 cb_url: str = 'https://cb-example.com',
40 encrypted_api_token: str = 'A'*100):
41 """Create terraform.tfvars file with the given configuration values."""
42 with open(CONFIG_FILE, 'w') as config_file:
43 config_file.write('\n'.join([
44 '// comment1',
45 'aws_account_id = "{}"'.format(account_id),
46 'aws_region = "{}" // comment2'.format(region),
47 'name_prefix = "{}" // comment3'.format(prefix),
48 'enable_carbon_black_downloader = {}'.format(str(enable_downloader).lower()),
49 'carbon_black_url = "{}" //comment4'.format(cb_url),
50 'encrypted_carbon_black_api_token = "{}"'.format(encrypted_api_token),
51 'force_destroy = false',
52 'objects_per_retro_message = 5',
53 '// comment5'
54 ]))
55
56 def setUp(self):
57 """Enable pyfakefs and write out Terraform config files."""

Calls

no outgoing calls