-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
78 additions
and
8 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@boostercloud/framework-core/fix-subnet-creation_2024-02-01-10-17.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@boostercloud/framework-core", | ||
"comment": "refactor subnet creation for Azure Provider", | ||
"type": "minor" | ||
} | ||
], | ||
"packageName": "@boostercloud/framework-core" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...ovider-azure-infrastructure/src/infrastructure/synth/gateway/terraform-subnet-security.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { toTerraformName } from '../../helper/utils' | ||
import { ApplicationSynthStack } from '../../types/application-synth-stack' | ||
import { subnetNetworkSecurityGroupAssociation } from '@cdktf/provider-azurerm' | ||
|
||
export class TerraformSubnetSecurity { | ||
static build({ | ||
terraformStack, | ||
appPrefix, | ||
networkSecurityGroup, | ||
subnet, | ||
}: ApplicationSynthStack): subnetNetworkSecurityGroupAssociation.SubnetNetworkSecurityGroupAssociation { | ||
if (!networkSecurityGroup) { | ||
throw new Error('Undefined networkSecurityGroup resource') | ||
} | ||
if (!subnet) { | ||
throw new Error('Undefined subnet resource') | ||
} | ||
|
||
return new subnetNetworkSecurityGroupAssociation.SubnetNetworkSecurityGroupAssociation( | ||
terraformStack, | ||
toTerraformName(appPrefix, 'snsg'), | ||
{ | ||
subnetId: subnet.id, | ||
networkSecurityGroupId: networkSecurityGroup.id, | ||
} | ||
) | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...mework-provider-azure-infrastructure/src/infrastructure/synth/gateway/terraform-subnet.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { toTerraformName } from '../../helper/utils' | ||
import { ApplicationSynthStack } from '../../types/application-synth-stack' | ||
import { subnet } from '@cdktf/provider-azurerm' | ||
|
||
export class TerraformSubnet { | ||
static build({ | ||
terraformStack, | ||
appPrefix, | ||
virtualNetwork, | ||
resourceGroupName, | ||
networkSecurityGroup, | ||
}: ApplicationSynthStack): subnet.Subnet { | ||
if (!networkSecurityGroup) { | ||
throw new Error('Undefined networkSecurityGroup resource') | ||
} | ||
if (!virtualNetwork) { | ||
throw new Error('Undefined virtualNetwork resource') | ||
} | ||
|
||
return new subnet.Subnet(terraformStack, toTerraformName(appPrefix, 'vsn'), { | ||
name: `${resourceGroupName}vsn`, | ||
resourceGroupName: resourceGroupName, | ||
virtualNetworkName: virtualNetwork.name, | ||
addressPrefixes: ['10.0.1.0/24'], | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters