Compute VM module refactor (#3805)
* add ad for compute-vm refactor * Exclue nic_type from validated fields, add split of main.tf and template.tf * boot disk * fix examples and fixtures * attached disks * fix further examples and module-level tests * remove extra file * fix mig examples * finish refactoring variables * align fast and other modules * refactor(compute-vm): align examples and ADR with the newly implemented interface This commit addresses the remaining references of the `instance_type` and `confidential_compute` parameters in the testing environment and updates the ADR. * feat(compute-vm): add network_performance_config to instance and templates This change implements the usage of the `network_performance_tier` variable we added earlier into the actual Terraform resources. --------- Co-authored-by: Wiktor Niesiobędzki <wiktorn@google.com>
This commit is contained in:
committed by
GitHub
parent
2c39df6453
commit
a4eb4d24fd
@@ -177,6 +177,25 @@ def _parse(body, enum=VAR_ENUM, re=VAR_RE, template=VAR_TEMPLATE):
|
||||
item[context].append(data)
|
||||
|
||||
|
||||
def _extract_title(element):
|
||||
'Extract and format text from marko elements.'
|
||||
if isinstance(element, str):
|
||||
return element
|
||||
if hasattr(element, 'children'):
|
||||
if isinstance(element.children, str):
|
||||
if element.get_type() == 'CodeSpan':
|
||||
return f'`{element.children}`'
|
||||
return element.children
|
||||
elif isinstance(element.children, list):
|
||||
inner = ''.join(_extract_title(c) for c in element.children)
|
||||
if element.get_type() == 'StrongEmphasis':
|
||||
return f'**{inner}**'
|
||||
elif element.get_type() == 'Emphasis':
|
||||
return f'*{inner}*'
|
||||
return inner
|
||||
return ''
|
||||
|
||||
|
||||
def create_toc(readme, skip=['contents']):
|
||||
'Create a Markdown table of contents a for README.'
|
||||
doc = marko.parse(readme)
|
||||
@@ -184,7 +203,7 @@ def create_toc(readme, skip=['contents']):
|
||||
headings = [x for x in doc.children if x.get_type() == 'Heading']
|
||||
skip = skip or []
|
||||
for h in headings[1:]:
|
||||
title = h.children[0].children
|
||||
title = _extract_title(h)
|
||||
slug = title.lower().strip()
|
||||
slug = re.sub(r'[^\w\s-]', '', slug)
|
||||
slug = re.sub(r'[-\s]+', '-', slug)
|
||||
|
||||
Reference in New Issue
Block a user