stackql-deploy 2.0.7

Infrastructure-as-code framework for declarative cloud resource management using StackQL
/*+ createorupdate */
INSERT INTO azure.compute.virtual_machine_extensions(
  resourceGroupName,
  subscriptionId,
  vmExtensionName,
  vmName,
  data__location,
  data__properties,
  data__tags
)
SELECT
  '{{ resource_group_name }}',
  '{{ subscription_id }}',
  '{{ vm_ext_name }}',
  '{{ vm_name }}',
  '{{ location }}',
  '{ "publisher": "Microsoft.Azure.Extensions", "type": "CustomScript", "typeHandlerVersion": "2.1", "settings": { "commandToExecute": "{{ command_to_execute }}"} }',
  '{{ global_tags }}';

/*+ statecheck, retries=5, retry_delay=5 */
SELECT COUNT(*) as count 
FROM azure.compute.virtual_machine_extensions
WHERE subscriptionId = '{{ subscription_id }}'
AND resourceGroupName = '{{ resource_group_name }}'
AND vmExtensionName = '{{ vm_ext_name }}'
AND vmName = '{{ vm_name }}'

/*+ exports */
SELECT 'http://' || '{{ public_ip_address }}' || ':8080' as web_url

/*+ delete */
DELETE FROM azure.compute.virtual_machine_extensions
WHERE subscriptionId = '{{ subscription_id }}'
AND resourceGroupName = '{{ resource_group_name }}'
AND vmExtensionName = '{{ vm_ext_name }}'
AND vmName = '{{ vm_name }}'