pulumi-django-azure 1.0.14__py3-none-any.whl → 1.0.16__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.
- pulumi_django_azure/django_deployment.py +50 -58
- {pulumi_django_azure-1.0.14.dist-info → pulumi_django_azure-1.0.16.dist-info}/LICENSE +1 -1
- {pulumi_django_azure-1.0.14.dist-info → pulumi_django_azure-1.0.16.dist-info}/METADATA +1 -1
- pulumi_django_azure-1.0.16.dist-info/RECORD +7 -0
- {pulumi_django_azure-1.0.14.dist-info → pulumi_django_azure-1.0.16.dist-info}/WHEEL +1 -1
- pulumi_django_azure-1.0.14.dist-info/RECORD +0 -7
- {pulumi_django_azure-1.0.14.dist-info → pulumi_django_azure-1.0.16.dist-info}/top_level.txt +0 -0
|
@@ -20,6 +20,9 @@ class HostDefinition:
|
|
|
20
20
|
self.zone = zone
|
|
21
21
|
self._identifier = identifier
|
|
22
22
|
|
|
23
|
+
def __eq__(self, other):
|
|
24
|
+
return self.host == other.host and self.zone.name == other.zone.name
|
|
25
|
+
|
|
23
26
|
@property
|
|
24
27
|
def identifier(self) -> str:
|
|
25
28
|
"""
|
|
@@ -65,6 +68,7 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
65
68
|
appservice_ip_prefix: str,
|
|
66
69
|
app_service_sku: azure.web.SkuDescriptionArgs,
|
|
67
70
|
storage_account_name: str,
|
|
71
|
+
storage_allowed_origins: Optional[Sequence[str]] = None,
|
|
68
72
|
pgadmin_access_ip: Optional[Sequence[str]] = None,
|
|
69
73
|
pgadmin_dns_zone: Optional[azure.network.Zone] = None,
|
|
70
74
|
cdn_host: Optional[HostDefinition] = None,
|
|
@@ -82,6 +86,7 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
82
86
|
:param appservice_ip_prefix: The IP prefix for the app service subnet.
|
|
83
87
|
:param app_service_sku: The SKU for the app service plan.
|
|
84
88
|
:param storage_account_name: The name of the storage account. Should be unique across Azure.
|
|
89
|
+
:param storage_allowed_origins: The origins (hosts) to allow access through CORS policy. You can specify '*' to allow all.
|
|
85
90
|
:param pgadmin_access_ip: The IP addresses to allow access to pgAdmin. If empty, all IP addresses are allowed.
|
|
86
91
|
:param pgadmin_dns_zone: The Azure DNS zone to a pgadmin DNS record in. (optional)
|
|
87
92
|
:param cdn_host: A custom CDN host name. (optional)
|
|
@@ -99,7 +104,7 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
99
104
|
self._vnet = vnet
|
|
100
105
|
|
|
101
106
|
# Storage resources
|
|
102
|
-
self._create_storage(account_name=storage_account_name)
|
|
107
|
+
self._create_storage(account_name=storage_account_name, allowed_origins=storage_allowed_origins)
|
|
103
108
|
self._cdn_host = self._create_cdn(custom_host=cdn_host)
|
|
104
109
|
|
|
105
110
|
# PostgreSQL resources
|
|
@@ -119,7 +124,7 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
119
124
|
# Create a pgAdmin app
|
|
120
125
|
self._create_pgadmin_app(access_ip=pgadmin_access_ip, dns_zone=pgadmin_dns_zone)
|
|
121
126
|
|
|
122
|
-
def _create_storage(self, account_name: str):
|
|
127
|
+
def _create_storage(self, account_name: str, allowed_origins: Optional[Sequence[str]] = None):
|
|
123
128
|
# Create blob storage
|
|
124
129
|
self._storage_account = azure.storage.StorageAccount(
|
|
125
130
|
f"sa-{self._name}",
|
|
@@ -135,6 +140,25 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
135
140
|
enable_https_traffic_only=True,
|
|
136
141
|
)
|
|
137
142
|
|
|
143
|
+
if allowed_origins:
|
|
144
|
+
azure.storage.BlobServiceProperties(
|
|
145
|
+
f"sa-{self._name}-blob-properties",
|
|
146
|
+
resource_group_name=self._rg,
|
|
147
|
+
account_name=self._storage_account.name,
|
|
148
|
+
blob_services_name="default",
|
|
149
|
+
cors=azure.storage.CorsRulesArgs(
|
|
150
|
+
cors_rules=[
|
|
151
|
+
azure.storage.CorsRuleArgs(
|
|
152
|
+
allowed_headers=["*"],
|
|
153
|
+
allowed_methods=["GET", "OPTIONS", "HEAD"],
|
|
154
|
+
allowed_origins=allowed_origins,
|
|
155
|
+
exposed_headers=["Access-Control-Allow-Origin"],
|
|
156
|
+
max_age_in_seconds=86400,
|
|
157
|
+
)
|
|
158
|
+
]
|
|
159
|
+
),
|
|
160
|
+
)
|
|
161
|
+
|
|
138
162
|
def _create_cdn(self, custom_host: Optional[HostDefinition]) -> pulumi.Output[str]:
|
|
139
163
|
"""
|
|
140
164
|
Create a CDN endpoint. If a host name is given, it will be used as the custom domain.
|
|
@@ -178,7 +202,7 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
178
202
|
profile_name=self._cdn_profile.name,
|
|
179
203
|
origin_host_header=endpoint_origin,
|
|
180
204
|
origins=[azure.cdn.DeepCreatedOriginArgs(name="origin-storage", host_name=endpoint_origin)],
|
|
181
|
-
query_string_caching_behavior=azure.cdn.QueryStringCachingBehavior.
|
|
205
|
+
query_string_caching_behavior=azure.cdn.QueryStringCachingBehavior.USE_QUERY_STRING,
|
|
182
206
|
)
|
|
183
207
|
|
|
184
208
|
pulumi.export("cdn_cname", self._cdn_endpoint.host_name)
|
|
@@ -526,7 +550,7 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
526
550
|
f"dns-comms-{suffix}-{host.identifier}-domain",
|
|
527
551
|
resource_group_name=self._rg,
|
|
528
552
|
zone_name=host.zone.name,
|
|
529
|
-
relative_record_set_name=
|
|
553
|
+
relative_record_set_name=host.host,
|
|
530
554
|
record_type="TXT",
|
|
531
555
|
ttl=3600,
|
|
532
556
|
txt_records=[
|
|
@@ -538,11 +562,16 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
538
562
|
|
|
539
563
|
# DKIM records (two CNAME records)
|
|
540
564
|
for record in ("d_kim", "d_kim2"):
|
|
565
|
+
if host.host == "@":
|
|
566
|
+
relative_record_set_name = records[record]["name"]
|
|
567
|
+
else:
|
|
568
|
+
relative_record_set_name = f"{records[record]['name']}.{host.host}"
|
|
569
|
+
|
|
541
570
|
r = azure.network.RecordSet(
|
|
542
571
|
f"dns-comms-{suffix}-{host.identifier}-{record}",
|
|
543
572
|
resource_group_name=self._rg,
|
|
544
573
|
zone_name=host.zone.name,
|
|
545
|
-
relative_record_set_name=
|
|
574
|
+
relative_record_set_name=relative_record_set_name,
|
|
546
575
|
record_type="CNAME",
|
|
547
576
|
ttl=records[record]["ttl"],
|
|
548
577
|
cname_record=azure.network.CnameRecordArgs(cname=records[record]["value"]),
|
|
@@ -882,39 +911,23 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
882
911
|
dependencies = []
|
|
883
912
|
|
|
884
913
|
if host.zone:
|
|
885
|
-
# Create a DNS record in the zone
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
],
|
|
901
|
-
)
|
|
914
|
+
# Create a DNS record in the zone.
|
|
915
|
+
# We always use an A record instead of CNAME to avoid collisions with TXT records.
|
|
916
|
+
a = azure.network.RecordSet(
|
|
917
|
+
f"dns-a-{name}-{self._name}-{host.identifier}",
|
|
918
|
+
resource_group_name=self._rg,
|
|
919
|
+
zone_name=host.zone.name,
|
|
920
|
+
relative_record_set_name=host.host,
|
|
921
|
+
record_type="A",
|
|
922
|
+
ttl=3600,
|
|
923
|
+
a_records=[
|
|
924
|
+
azure.network.ARecordArgs(
|
|
925
|
+
ipv4_address=virtual_ip,
|
|
926
|
+
)
|
|
927
|
+
],
|
|
928
|
+
)
|
|
902
929
|
|
|
903
|
-
|
|
904
|
-
else:
|
|
905
|
-
# Create a CNAME record for the custom hostname
|
|
906
|
-
cname = azure.network.RecordSet(
|
|
907
|
-
f"dns-cname-{name}-{self._name}-{host.identifier}",
|
|
908
|
-
resource_group_name=self._rg,
|
|
909
|
-
zone_name=host.zone.name,
|
|
910
|
-
relative_record_set_name=host.host,
|
|
911
|
-
record_type="CNAME",
|
|
912
|
-
ttl=3600,
|
|
913
|
-
cname_record=azure.network.CnameRecordArgs(
|
|
914
|
-
cname=app.default_host_name,
|
|
915
|
-
),
|
|
916
|
-
)
|
|
917
|
-
dependencies.append(cname)
|
|
930
|
+
dependencies.append(a)
|
|
918
931
|
|
|
919
932
|
# For the certificate validation to work
|
|
920
933
|
relative_record_set_name = "asuid" if host.host == "@" else pulumi.Output.concat("asuid.", host.host)
|
|
@@ -1031,27 +1044,6 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
1031
1044
|
scope=self._cdn_endpoint.id,
|
|
1032
1045
|
)
|
|
1033
1046
|
|
|
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
1047
|
return app
|
|
1056
1048
|
|
|
1057
1049
|
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.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pulumi_django_azure/__init__.py,sha256=5RY9reSVNw-HULrOXfhcq3cyPne-94ojFmeV1m6kIVg,79
|
|
2
|
+
pulumi_django_azure/django_deployment.py,sha256=NorAfJ8i4zhzY6dZ7TBDB3NKwqfAMH2-PyMQv5IurPw,43986
|
|
3
|
+
pulumi_django_azure-1.0.16.dist-info/LICENSE,sha256=tlZQiilfsHDYlvhWMA5PvDV2FxpaCQbE9aapcygnhEQ,1088
|
|
4
|
+
pulumi_django_azure-1.0.16.dist-info/METADATA,sha256=SZX_zbLE-ytF-NYk3krUN8k3hbKzfyiGil0Sz9ATk3g,13954
|
|
5
|
+
pulumi_django_azure-1.0.16.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
6
|
+
pulumi_django_azure-1.0.16.dist-info/top_level.txt,sha256=MNPRJhq-_G8EMCHRkjdcb_xrqzOkmKogXUGV7Ysz3g0,20
|
|
7
|
+
pulumi_django_azure-1.0.16.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,,
|
|
File without changes
|