Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@
"@aws-sdk/credential-providers": "^3.886.0",
"@aws-sdk/types": "^3.804.0",
"@cdktf/provider-aws": "^19.63.0",
"@cdktf/provider-azurerm": "^14.12.0",
"@cdktf/provider-cloudflare": "^13.4.0",
"@cdktf/provider-azurerm": "^14.22.0",
"@cdktf/provider-cloudflare": "^13.8.0",
"@types/lodash": "^4.17.20",
"@types/node": "^22.15.17",
"@types/uuid": "^10.0.0",
"app-root-path": "^3.1.0",
"aws-cdk-lib": "^2.195.0",
"cdktf": "^0.21.0",
"cdktf-local-exec": "^0.5.71",
"constructs": "^10.4.2",
"constructs": "^10.4.3",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"nconf": "^0.13.0",
Expand Down
74 changes: 37 additions & 37 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 4 additions & 33 deletions src/lib/azure/services/api-management/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ import {
ApiManagementLogger,
ApiManagementLoggerApplicationInsights,
} from '@cdktf/provider-azurerm/lib/api-management-logger'
import { ApiManagementBackend } from '@cdktf/provider-azurerm/lib/api-management-backend'
import { ApiManagementRedisCache } from '@cdktf/provider-azurerm/lib/api-management-redis-cache'
import { RedisCache } from '@cdktf/provider-azurerm/lib/redis-cache'
import { Resource } from '../../.gen/providers/azapi/resource'
import { CommonAzureConstruct } from '../../common'
import { createAzureTfOutput } from '../../utils'
import {
ApiManagementProps,
ApiManagementBackendProps,
ApiManagementApiProps,
ApiManagementCustomDomainProps,
ApiManagementRedisCacheProps,
} from './types'
import _ from 'lodash'

Expand Down Expand Up @@ -144,39 +143,11 @@ export class AzureApiManagementManager {
public createApiManagementBackend(id: string, scope: CommonAzureConstruct, props: ApiManagementBackendProps) {
if (!props) throw `Props undefined for ${id}`

// Commenting as circuit breaker config is currently not supported
/*
const apiManagementBackend = new ApiManagementBackend(scope, `${id}-am-be`, {
...props,
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementBackend),
description: props.description ?? `Backend for ${props.name}-${scope.props.stage}`,
protocol: props.protocol ?? 'http',
})
*/

const apiManagementBackend = new Resource(scope, `${id}-am-be`, {
type: 'Microsoft.ApiManagement/service/backends@2024-06-01-preview',
...props,
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementBackend),
parentId: props.apiManagementId,

body: {
properties: {
circuitBreaker: props.circuitBreaker,
credentials: props.credentials,
description: props.description ?? `Backend for ${props.name}-${scope.props.stage}`,
url: props.url,
resourceId: props.resourceId,
protocol: props.protocol ?? 'http',
},
},

responseExportValues: ['*'],

ignoreMissingProperty: true,
ignoreCasing: true,
schemaValidationEnabled: false,

lifecycle: props.lifecycle,
description: props.description ?? `Backend for ${props.name}-${scope.props.stage}`,
protocol: props.protocol ?? 'http',
})

createAzureTfOutput(`${id}-apiManagementBackendName`, scope, apiManagementBackend.name)
Expand Down
6 changes: 2 additions & 4 deletions src/test/azure/services/api-management-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const construct = Testing.synth(commonStack.construct)

console.log(expect(construct).toHaveResourceWithProperties(ApiManagement, {}))
console.log(expect(construct).toHaveResourceWithProperties(ApiManagementApi, {}))
//console.log(expect(construct).toHaveResourceWithProperties(ApiManagementBackend, {}))
console.log(expect(construct).toHaveResourceWithProperties(ApiManagementBackend, {}))
console.log(expect(construct).toHaveResourceWithProperties(ApiManagementApiOperation, {}))
console.log(expect(construct).toHaveResourceWithProperties(ApiManagementApiOperationPolicy, {}))

Expand Down Expand Up @@ -198,7 +198,6 @@ describe('TestAzureApiManagementConstruct', () => {
})
})

/*
describe('TestAzureApiManagementConstruct', () => {
test('provisions api management backend as expected', () => {
expect(construct).toHaveResourceWithProperties(ApiManagementBackend, {
Expand All @@ -210,7 +209,6 @@ describe('TestAzureApiManagementConstruct', () => {
})
})
})
*/

describe('TestAzureApiManagementConstruct', () => {
test('provisions api management api operation as expected', () => {
Expand Down Expand Up @@ -256,7 +254,7 @@ describe('TestAzureApiManagementConstruct', () => {
'${azurerm_api_management_api_operation.test-api-management-dev-apim-api-operation-test-get.operation_id}',
resource_group_name: '${azurerm_api_management_api.test-api-management-dev-am-api.resource_group_name}',
xml_content:
'<policies>\n <inbound>\n <base />\n <rate-limit-by-key calls="25" renewal-period="1" counter-key="subscriptionId-${azurerm_api_management_api_operation.test-api-management-dev-apim-api-operation-test-get.operation_id}"/>\n \n \n \n <set-backend-service id="apim-generated-policy" backend-id="${azapi_resource.test-api-management-dev-am-be.name}" />\n </inbound>\n <backend>\n <base />\n </backend>\n <outbound>\n <base />\n \n \n </outbound>\n <on-error>\n <base />\n </on-error>\n </policies>',
'<policies>\n <inbound>\n <base />\n <rate-limit-by-key calls="25" renewal-period="1" counter-key="subscriptionId-${azurerm_api_management_api_operation.test-api-management-dev-apim-api-operation-test-get.operation_id}"/>\n \n \n \n <set-backend-service id="apim-generated-policy" backend-id="${azurerm_api_management_backend.test-api-management-dev-am-be.name}" />\n </inbound>\n <backend>\n <base />\n </backend>\n <outbound>\n <base />\n \n \n </outbound>\n <on-error>\n <base />\n </on-error>\n </policies>',
})
})
})
Expand Down
Loading