Skip to content

Added support to enable CORS Rules for the Blob Service Containers

Krishna Nikhil Vedurumudi requested to merge krveduru/enableCors into master

Infrastructure Submissions:


  • [YES/NO] Have you added an explanation of what your changes do and why you'd like us to include them?
  • [YES/NO] I have updated the documentation accordingly.
  • [YES/NO/NA] I have added tests to cover my changes.
  • [YES] All new and existing tests passed.
  • [YES/NO/NA] I have formatted the terraform code. (terraform fmt -recursive && go fmt ./...)

Current Behavior or Linked Issues


#80 (closed)

Does this introduce a breaking change?


  • [NO]

Other information


Terraform plan output

      + blob_properties {
          + cors_rule {
              + allowed_headers    = [
                  + "*",
                ]
              + allowed_methods    = [
                  + "PUT",
                  + "GET",
                ]
              + allowed_origins    = [
                  + "https://osdu-mvp.msft-osdu-test.org",
                ]
              + exposed_headers    = [
                  + "*",
                ]
              + max_age_in_seconds = 60
            }
        }

Unit Tests result

 TestTemplate 2021-01-08T18:19:38+05:30 command.go:121: Deleted workspace "osdu-testing-xr9jtf"!--- PASS: TestTemplate (464.67s)
PASS
ok      github.com/microsoft/cobalt/infra/templates/osdu-r3-mvp/data_partition/tests/unit       466.421s

Changes after terraform apply

CORS

To test the changes

curl --location --request OPTIONS 'https://osdumvpidcmvpdi2ordata.blob.core.windows.net/' --header 'Origin: https://osdu-mvp.msft-osdu-test.org' --header 'Access-Control-Request-Method: PUT' --data-raw ''

// Returns 200 OK

curl --location --request OPTIONS 'https://osdumvpidcmvpdi2ordata.blob.core.windows.net/' --header 'Origin: https://foo-mvp.msft-osdu-test.org' --header 'Access-Control-Request-Method: PUT' --data-raw ''

// Returns 403
Edited by Krishna Nikhil Vedurumudi

Merge request reports