@gradientedge/cdk-utils-azure 2.22.0 → 2.23.0

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.
@@ -14,6 +14,10 @@ export function isTaggableResource(resourceType) {
14
14
  return false;
15
15
  if (resourceType.startsWith('pulumi:'))
16
16
  return false;
17
+ if (resourceType.startsWith('command:'))
18
+ return false;
19
+ if (resourceType === 'azure-native:appconfiguration:KeyValue')
20
+ return false;
17
21
  if (resourceType.startsWith('azure-native:apimanagement:') &&
18
22
  resourceType !== 'azure-native:apimanagement:ApiManagementService')
19
23
  return false;
@@ -307,6 +307,13 @@ export class AzureFunctionApp extends CommonAzureConstruct {
307
307
  accountName: this.appStorageAccount.name,
308
308
  }).keys[0].value};EndpointSuffix=core.windows.net`,
309
309
  },
310
+ {
311
+ name: 'AzureWebJobsStorage',
312
+ value: pulumi.interpolate `DefaultEndpointsProtocol=https;AccountName=${this.appStorageAccount.name};AccountKey=${listStorageAccountKeysOutput({
313
+ resourceGroupName: this.resourceGroup.name,
314
+ accountName: this.appStorageAccount.name,
315
+ }).keys[0].value};EndpointSuffix=core.windows.net`,
316
+ },
310
317
  ],
311
318
  connectionStrings: Object.fromEntries(this.appConnectionStrings.map(cs => [cs.name, { type: cs.type, value: cs.value }])),
312
319
  },
@@ -1,6 +1,6 @@
1
1
  import { HostnameType, NamedValue, PolicyContentFormat } from '@pulumi/azure-native/apimanagement/index.js';
2
2
  import { getVaultOutput } from '@pulumi/azure-native/keyvault/index.js';
3
- import { listWebAppHostKeysOutput } from '@pulumi/azure-native/web/index.js';
3
+ import { listWebAppHostKeys } from '@pulumi/azure-native/web/index.js';
4
4
  import * as pulumi from '@pulumi/pulumi';
5
5
  import _ from 'lodash';
6
6
  import { RoleDefinitionId } from '../../services/index.js';
@@ -74,16 +74,38 @@ export class AzureRestApiFunction extends AzureFunctionApp {
74
74
  createNamespaceSecret() {
75
75
  if (!this.props.apiManagement.useExistingApiManagement)
76
76
  return;
77
- const functionDefaultKey = listWebAppHostKeysOutput({
78
- name: this.app.name,
79
- resourceGroupName: this.resourceGroup.name,
77
+ // Fetch function host keys with retry — the runtime may not be ready immediately after code deployment
78
+ const functionKey = pulumi.all([this.app.name, this.resourceGroup.name]).apply(async ([appName, rgName]) => {
79
+ if (pulumi.runtime.isDryRun())
80
+ return 'previewing';
81
+ const maxRetries = 10;
82
+ const delayMs = 15000;
83
+ for (let i = 0; i < maxRetries; i++) {
84
+ try {
85
+ const keys = await listWebAppHostKeys({ name: appName, resourceGroupName: rgName });
86
+ const defaultKey = keys.functionKeys?.['default'];
87
+ if (defaultKey)
88
+ return defaultKey;
89
+ }
90
+ catch {
91
+ // runtime not ready yet
92
+ }
93
+ if (i < maxRetries - 1) {
94
+ await new Promise(resolve => setTimeout(resolve, delayMs));
95
+ }
96
+ }
97
+ throw new Error(`Failed to retrieve function host keys for ${appName} after ${maxRetries} attempts`);
80
98
  });
81
99
  this.api.namedValueSecret = this.keyVaultManager.createKeyVaultSecret(`${this.id}-key-vault-api-namespace-secret`, this, {
82
100
  vaultName: this.api.authKeyVault.name,
83
101
  secretName: pulumi.interpolate `${this.app.name}key`,
84
102
  resourceGroupName: this.props.apiAuthKeyVault.resourceGroupName,
85
103
  properties: {
86
- value: functionDefaultKey.functionKeys?.apply(keys => keys?.['default'] ?? ''),
104
+ value: functionKey,
105
+ attributes: {
106
+ enabled: true,
107
+ },
108
+ contentType: '',
87
109
  },
88
110
  });
89
111
  }
@@ -1,4 +1,5 @@
1
1
  import { Api, ApiOperation, Backend, NamedValue } from '@pulumi/azure-native/apimanagement/index.js';
2
+ import { Input } from '@pulumi/pulumi';
2
3
  import { ApiManagementApiProps, ApiManagementBackendProps, ApiManagementProps, ApplicationInsightsProps, AzureApi, AzureFunctionAppProps, AzureRestApiProps } from '../../index.js';
3
4
  /** @category Interface */
4
5
  export interface ApiManagementRestApiProps extends ApiManagementProps {
@@ -30,5 +31,5 @@ export interface AzureApiFunction extends AzureApi {
30
31
  corsPolicyXmlContent?: string;
31
32
  managementApi: Api;
32
33
  namedValue: NamedValue;
33
- validateJwtPolicyXmlContent?: string;
34
+ validateJwtPolicyXmlContent?: Input<string>;
34
35
  }
@@ -58,9 +58,7 @@ export class AzureEventgridManager {
58
58
  throw new Error(`Props undefined for ${id}`);
59
59
  return getTopicOutput({
60
60
  topicName: scope.resourceNameFormatter.format(props.topicName?.toString(), scope.props.resourceNameOptions?.eventGridTopic),
61
- resourceGroupName: (props.resourceGroupName ?? scope.props.resourceGroupName)
62
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
63
- : props.resourceGroupName,
61
+ resourceGroupName: props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName),
64
62
  }, { parent: scope, ...resourceOptions });
65
63
  }
66
64
  /**
@@ -159,7 +159,7 @@ export class AzureFunctionManager {
159
159
  ],
160
160
  },
161
161
  },
162
- }, { parent: functionApp, ...resourceOptions });
162
+ }, { parent: functionApp, dependsOn: [functionApp], ...resourceOptions });
163
163
  return functionApp;
164
164
  }
165
165
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils-azure",
3
- "version": "2.22.0",
3
+ "version": "2.23.0",
4
4
  "description": "Azure Pulumi utilities for @gradientedge/cdk-utils",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",