-
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.
- Loading branch information
1 parent
bb9ddcd
commit 6b539e2
Showing
6 changed files
with
68 additions
and
8 deletions.
There are no files selected for viewing
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