-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manage cors headers in terraform #4115
Conversation
Terraform plan for meta No changes. Your infrastructure matches the configuration.
✅ Plan applied in Deploy to Development and Management Environment #749 |
Terraform plan for dev Plan: 1 to add, 0 to change, 0 to destroy.Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# module.dev.module.cors.null_resource.cors_header will be created
+ resource "null_resource" "cors_header" {
+ id = (known after apply)
+ triggers = {
+ "always_run" = (known after apply)
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
Warning: Argument is deprecated
with module.dev-backups-bucket.cloudfoundry_service_instance.bucket,
on /tmp/terraform-data-dir/modules/dev-backups-bucket/s3/main.tf line 14, in resource "cloudfoundry_service_instance" "bucket":
14: recursive_delete = var.recursive_delete
Since CF API v3, recursive delete is always done on the cloudcontroller side.
This will be removed in future releases
(and 6 more similar warnings elsewhere) ✅ Plan applied in Deploy to Development and Management Environment #749 |
307b392
to
40f3369
Compare
Closing PR for a bit, want to do a bit more testing |
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable to me. I compared to Tadhg and Bret's discussion on the original ticket, as well as the docs you linked inline, and this looks like a good approach. Let's make sure we manually test the headers once it's on staging as well 👍
Based on discussion with @sambodeme we are kind of leaning towards it being safe to apply this config every time terraform runs.
Note: I did jsonencode() the cors.json like we have done in other places, but it didn't exactly like the string, so opted for files containing the json. All of this is self contained in the
shared/modules/cors/
module, called byshared/env/cors.tf
Based on this preview deployment, everything looks like it is working and CORS Tester on preview appears to match CORS Tester on dev
Debugging Information
As far as I can tell.. I ran this back to back multiple times.
Run 1 Passed as expected
Run 2 Failed
Run 3 Failed.
And then I waited a few minutes and Run 4 Passed. This time, I added a
sleep 10
after the creation of the service key, for the CF api.Finally, I ran Run 5 and immediately ran Run 6 and Both Passed.
Lesson to be gained, since we are dealing with mutliple APIs, the cf api being a little delayed on responses, it was running too quickly, so the
sleep 10
gave the api enough time to process and register the creation/deletion of the service keys rapidly.PR checklist: submitters
main
into your branch shortly before creating the PR. (You should also be mergingmain
into your branch regularly during development.)git status | grep migrations
. If there are any results, you probably need to add them to the branch for the PR. Your PR should have only one new migration file for each of the component apps, except in rare circumstances; you may need to delete some and re-runpython manage.py makemigrations
to reduce the number to one. (Also, unless in exceptional circumstances, your PR should not delete any migration files.)PR checklist: reviewers
make docker-clean; make docker-first-run && docker compose up
; then rundocker compose exec web /bin/bash -c "python manage.py test"
The larger the PR, the stricter we should be about these points.