Skip to content
This repository was archived by the owner on Oct 4, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(hub-501): remove change to virtual network type and add ability …
…to skip apim arm template
  • Loading branch information
kevin-boutin committed Sep 14, 2023
commit 17c61d00f37e751f79e39910fe98e4819abf76b4
2 changes: 1 addition & 1 deletion src/armTemplates/resources/apim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class ApimResource implements ArmResourceTemplateGenerator {
"publisherName": "[parameters('apimPublisherName')]",
"notificationSenderEmail": "[email protected]",
"hostnameConfigurations": [],
"virtualNetworkType": "External"
"virtualNetworkType": "None"
}
}
]
Expand Down
2 changes: 2 additions & 0 deletions src/models/apiManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export interface ApiManagementConfig {
ipFilters?: ApiIpFilterPolicy[];
/** The API's header policies */
checkHeaders?: ApiCheckHeaderPolicy[];
/** Whether or not the APIM is included in the ARM template */
skipArmTemplate?: boolean;
/** The pricing SKU for the APIM instance */
sku?: {
/** The SKU name, (consumption | developer | basic | standard | premium) */
Expand Down
14 changes: 11 additions & 3 deletions src/services/armService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export class ArmService extends BaseService {
const mergedTemplate = template.getTemplate(this.config);
let parameters = template.getParameters(this.config);

if (this.config.provider.apim) {
const apimProvider = this.config.provider.apim;

if (apimProvider && !(apimProvider.skipArmTemplate && apimProvider.skipArmTemplate.toString() === "true")) {
const apimTemplate = apimResource.getTemplate();
const apimParameters = apimResource.getParameters(this.config);

Expand All @@ -61,6 +63,12 @@ export class ArmService extends BaseService {
};
}

// add tags to all resources
mergedTemplate.resources = mergedTemplate.resources.map(r => ({
...r,
tags: this.config.provider.tags,
}));

return {
template: mergedTemplate,
parameters,
Expand Down Expand Up @@ -102,7 +110,7 @@ export class ArmService extends BaseService {
}

deployment.parameters = deployment.parameters || {};

for (const key of Object.keys(deployment.parameters)) {
if (!deployment.parameters[key].value) {
delete deployment.parameters[key];
Expand Down Expand Up @@ -143,7 +151,7 @@ export class ArmService extends BaseService {
}

private areDeploymentsEqual(current: ArmDeployment, previous: ArmDeployment): boolean {
if (!current || !previous) {
if (!current || !previous || !previous.template || !previous.parameters) {
return false;
}
const mergedDefaultParameters = this.mergeDefaultParams(current.parameters, current.template.parameters);
Expand Down