Skip to content

Commit

Permalink
fixup! Fix: Service responses are not compressed (#6360)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsotirho-ucsc committed Aug 12, 2024
1 parent f91a97d commit 9004360
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/azul/terraform.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,13 +793,15 @@ def tf_config(self, app_name):
del deployment['lifecycle']
deployment['triggers'] = {'redeployment': deployment.pop('stage_description')}

# Instead of specifying this property in the related Terraform
# resource, using an AWS API Gateway extension to the OpenAPI
# specification lets us avoid maintaining a complicated trigger
# dependency between Terraform resources.
# Using Terraform to specify the REST API minimum compression size
# proved to be problematic as it would first make an UpdateRestApi call
# to set the property, followed by a PutRestApi call with mode=overwrite
# which would reset the property back to its default value (disabled).
# Setting this property using AWS API Gateway extensions to the OpenAPI
# specification works around this issue.
#
rest_api = resources['aws_api_gateway_rest_api'][app_name]
assert 'minimum_compression_size' not in rest_api, rest_api.keys()
assert 'minimum_compression_size' not in rest_api, rest_api
openapi_spec = json.loads(locals[app_name])
key = 'x-amazon-apigateway-minimum-compression-size'
openapi_spec[key] = config.minimum_compression_size
Expand Down

0 comments on commit 9004360

Please sign in to comment.