-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_subnet.iql
More file actions
38 lines (35 loc) · 1.18 KB
/
example_subnet.iql
File metadata and controls
38 lines (35 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*+ createorupdate */
INSERT INTO azure.network.subnets(
subnetName,
virtualNetworkName,
resourceGroupName,
subscriptionId,
data__properties
)
SELECT
'{{ subnet_name }}',
'{{ vnet_name }}',
'{{ resource_group_name }}',
'{{ subscription_id }}',
'{"addressPrefix": "{{ subnet_cidr }}"}'
/*+ statecheck, retries=5, retry_delay=5 */
SELECT COUNT(*) as count FROM azure.network.subnets
WHERE subscriptionId = '{{ subscription_id }}'
AND resourceGroupName = '{{ resource_group_name }}'
AND virtualNetworkName = '{{ vnet_name }}'
AND subnetName = '{{ subnet_name }}'
AND JSON_EXTRACT(properties, '$.addressPrefix') = '{{ subnet_cidr }}'
/*+ exports */
SELECT '{{ subnet_name }}' as subnet_name,
id as subnet_id
FROM azure.network.subnets
WHERE subscriptionId = '{{ subscription_id }}'
AND resourceGroupName = '{{ resource_group_name }}'
AND virtualNetworkName = '{{ vnet_name }}'
AND subnetName = '{{ subnet_name }}'
/*+ delete */
DELETE FROM azure.network.subnets
WHERE subscriptionId = '{{ subscription_id }}'
AND resourceGroupName = '{{ resource_group_name }}'
AND virtualNetworkName = '{{ vnet_name }}'
AND subnetName = '{{ subnet_name }}'