pulumi-django-azure 1.0.14__py3-none-any.whl → 1.0.15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pulumi-django-azure might be problematic. Click here for more details.

@@ -65,6 +65,7 @@ class DjangoDeployment(pulumi.ComponentResource):
65
65
  appservice_ip_prefix: str,
66
66
  app_service_sku: azure.web.SkuDescriptionArgs,
67
67
  storage_account_name: str,
68
+ storage_allowed_origins: Optional[Sequence[str]] = None,
68
69
  pgadmin_access_ip: Optional[Sequence[str]] = None,
69
70
  pgadmin_dns_zone: Optional[azure.network.Zone] = None,
70
71
  cdn_host: Optional[HostDefinition] = None,
@@ -82,6 +83,7 @@ class DjangoDeployment(pulumi.ComponentResource):
82
83
  :param appservice_ip_prefix: The IP prefix for the app service subnet.
83
84
  :param app_service_sku: The SKU for the app service plan.
84
85
  :param storage_account_name: The name of the storage account. Should be unique across Azure.
86
+ :param storage_allowed_origins: The origins (hosts) to allow access through CORS policy. You can specify '*' to allow all.
85
87
  :param pgadmin_access_ip: The IP addresses to allow access to pgAdmin. If empty, all IP addresses are allowed.
86
88
  :param pgadmin_dns_zone: The Azure DNS zone to a pgadmin DNS record in. (optional)
87
89
  :param cdn_host: A custom CDN host name. (optional)
@@ -99,7 +101,7 @@ class DjangoDeployment(pulumi.ComponentResource):
99
101
  self._vnet = vnet
100
102
 
101
103
  # Storage resources
102
- self._create_storage(account_name=storage_account_name)
104
+ self._create_storage(account_name=storage_account_name, allowed_origins=storage_allowed_origins)
103
105
  self._cdn_host = self._create_cdn(custom_host=cdn_host)
104
106
 
105
107
  # PostgreSQL resources
@@ -119,7 +121,7 @@ class DjangoDeployment(pulumi.ComponentResource):
119
121
  # Create a pgAdmin app
120
122
  self._create_pgadmin_app(access_ip=pgadmin_access_ip, dns_zone=pgadmin_dns_zone)
121
123
 
122
- def _create_storage(self, account_name: str):
124
+ def _create_storage(self, account_name: str, allowed_origins: Optional[Sequence[str]] = None):
123
125
  # Create blob storage
124
126
  self._storage_account = azure.storage.StorageAccount(
125
127
  f"sa-{self._name}",
@@ -135,6 +137,25 @@ class DjangoDeployment(pulumi.ComponentResource):
135
137
  enable_https_traffic_only=True,
136
138
  )
137
139
 
140
+ if allowed_origins:
141
+ azure.storage.BlobServiceProperties(
142
+ f"sa-{self._name}-blob-properties",
143
+ resource_group_name=self._rg,
144
+ account_name=self._storage_account.name,
145
+ blob_services_name="default",
146
+ cors=azure.storage.CorsRulesArgs(
147
+ cors_rules=[
148
+ azure.storage.CorsRuleArgs(
149
+ allowed_headers=["*"],
150
+ allowed_methods=["GET", "OPTIONS", "HEAD"],
151
+ allowed_origins=allowed_origins,
152
+ exposed_headers=["Access-Control-Allow-Origin"],
153
+ max_age_in_seconds=86400,
154
+ )
155
+ ]
156
+ ),
157
+ )
158
+
138
159
  def _create_cdn(self, custom_host: Optional[HostDefinition]) -> pulumi.Output[str]:
139
160
  """
140
161
  Create a CDN endpoint. If a host name is given, it will be used as the custom domain.
@@ -178,7 +199,7 @@ class DjangoDeployment(pulumi.ComponentResource):
178
199
  profile_name=self._cdn_profile.name,
179
200
  origin_host_header=endpoint_origin,
180
201
  origins=[azure.cdn.DeepCreatedOriginArgs(name="origin-storage", host_name=endpoint_origin)],
181
- query_string_caching_behavior=azure.cdn.QueryStringCachingBehavior.IGNORE_QUERY_STRING,
202
+ query_string_caching_behavior=azure.cdn.QueryStringCachingBehavior.USE_QUERY_STRING,
182
203
  )
183
204
 
184
205
  pulumi.export("cdn_cname", self._cdn_endpoint.host_name)
@@ -1031,27 +1052,6 @@ class DjangoDeployment(pulumi.ComponentResource):
1031
1052
  scope=self._cdn_endpoint.id,
1032
1053
  )
1033
1054
 
1034
- # Create a CORS rules for this website
1035
- origins = [pulumi.Output.concat("https://", host.full_host) for host in website_hosts] if website_hosts else ["*"]
1036
-
1037
- azure.storage.BlobServiceProperties(
1038
- f"sa-{name}-blob-properties",
1039
- resource_group_name=self._rg,
1040
- account_name=self._storage_account.name,
1041
- blob_services_name="default",
1042
- cors=azure.storage.CorsRulesArgs(
1043
- cors_rules=[
1044
- azure.storage.CorsRuleArgs(
1045
- allowed_headers=["*"],
1046
- allowed_methods=["GET", "OPTIONS", "HEAD"],
1047
- allowed_origins=origins,
1048
- exposed_headers=["Access-Control-Allow-Origin"],
1049
- max_age_in_seconds=86400,
1050
- )
1051
- ]
1052
- ),
1053
- )
1054
-
1055
1055
  return app
1056
1056
 
1057
1057
  def _strip_off_dns_zone_name(self, host: str, zone: azure.network.Zone) -> pulumi.Output[str]:
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pulumi-django-azure
3
- Version: 1.0.14
3
+ Version: 1.0.15
4
4
  Summary: Simply deployment of Django on Azure with Pulumi
5
5
  Author-email: Maarten Ureel <maarten@youreal.eu>
6
6
  License: MIT License
@@ -0,0 +1,7 @@
1
+ pulumi_django_azure/__init__.py,sha256=5RY9reSVNw-HULrOXfhcq3cyPne-94ojFmeV1m6kIVg,79
2
+ pulumi_django_azure/django_deployment.py,sha256=dTbzASxVeDSLzTx3MN5UcbZTVhtZBbsaplF-mrkOvoc,44421
3
+ pulumi_django_azure-1.0.15.dist-info/LICENSE,sha256=tlZQiilfsHDYlvhWMA5PvDV2FxpaCQbE9aapcygnhEQ,1088
4
+ pulumi_django_azure-1.0.15.dist-info/METADATA,sha256=FUubwm450nWLBkxdvinFLDu-jTH8G8POYpcDq_WcD3g,13954
5
+ pulumi_django_azure-1.0.15.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
6
+ pulumi_django_azure-1.0.15.dist-info/top_level.txt,sha256=MNPRJhq-_G8EMCHRkjdcb_xrqzOkmKogXUGV7Ysz3g0,20
7
+ pulumi_django_azure-1.0.15.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- pulumi_django_azure/__init__.py,sha256=5RY9reSVNw-HULrOXfhcq3cyPne-94ojFmeV1m6kIVg,79
2
- pulumi_django_azure/django_deployment.py,sha256=BWw8GVSsjPLIu2ud09KJGr4D-G7VuJNnJey4nBTCEHI,44199
3
- pulumi_django_azure-1.0.14.dist-info/LICENSE,sha256=NX2LN3U319Zaac8b7ZgfNOco_nTBbN531X_M_13niSg,1087
4
- pulumi_django_azure-1.0.14.dist-info/METADATA,sha256=4po_NMDQbKi7lopg17jjZ1LrLM4Ojoy7yiF7NdIibAs,13954
5
- pulumi_django_azure-1.0.14.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
6
- pulumi_django_azure-1.0.14.dist-info/top_level.txt,sha256=MNPRJhq-_G8EMCHRkjdcb_xrqzOkmKogXUGV7Ysz3g0,20
7
- pulumi_django_azure-1.0.14.dist-info/RECORD,,