Skip to content

Commit

Permalink
Merge pull request #108 from alphagov/split-workspaces
Browse files Browse the repository at this point in the history
Don't attempt to loop through root_module in diff generator
  • Loading branch information
samsimpson1 authored Sep 5, 2024
2 parents e0bf949 + da67c11 commit 626b4c8
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions diff-generator/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@ def find_vcls(plan):
before = plan['prior_state']['values']['root_module']
after = plan['planned_values']['root_module']

for module in before:
for resource in module['resources']:
if resource['type'] == "fastly_service_vcl":
address = resource['address']
for resource in before['resources']:
if resource['type'] == "fastly_service_vcl":
address = resource['address']
vcl = resource['values']['vcl'][0]['content']
vcls[address] = {
"before": vcl
}
for resource in after['resources']:
if resource['type'] == "fastly_service_vcl":
address = resource['address']
if address in vcls:
vcl = resource['values']['vcl'][0]['content']
vcls[address] = {
"before": vcl
}
for module in after:
for resource in module['resources']:
if resource['type'] == "fastly_service_vcl":
address = resource['address']
if address in vcls:
vcl = resource['values']['vcl'][0]['content']
vcls[address]['after'] = vcl
vcls[address]['after'] = vcl
return vcls

def generate_unified_diff(vcls):
Expand Down

0 comments on commit 626b4c8

Please sign in to comment.