Created
October 5, 2022 10:55
-
-
Save hibri/feea23d9101049b25f968ab6786ec66f to your computer and use it in GitHub Desktop.
First pass at using cdk tf
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
class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
App app = new App(); | |
MyStack stack = new MyStack(app, "datafactory"); | |
new LocalBackend(stack); | |
app.Synth(); | |
} | |
} | |
public class MyStack : TerraformStack | |
{ | |
public MyStack(Construct scope, string id) : base(scope, id) | |
{ | |
var azurermProviderConfig = new AzurermProviderConfig() { Features = new AzurermProviderFeatures() }; | |
var azurermProvider = new AzurermProvider(this, "AzureRm", azurermProviderConfig); | |
ResourceGroup rg = new ResourceGroup(this, "hibri-test", new ResourceGroupConfig | |
{ | |
Location = "uksouth", | |
Name = "hibri-test" | |
}); | |
var storageAccountConfig = new StorageAccountConfig | |
{ | |
Name = "hibrifuncstr", | |
ResourceGroupName = rg.Name, | |
Location = rg.Location, | |
AccountReplicationType = "LRS", | |
AccountTier = "Standard" | |
}; | |
var functionStorageAccount = new StorageAccount(this, "hibrifuncstr", storageAccountConfig); | |
var appServicePlanConfig = new ServicePlanConfig | |
{ | |
Name = "test-plan", | |
ResourceGroupName = rg.Name, | |
Location = rg.Location, | |
OsType = "Linux", | |
SkuName = "B1" | |
}; | |
var appServicePlan = new ServicePlan(this, "test-plan", appServicePlanConfig); | |
var functionAppConfig = new LinuxFunctionAppConfig | |
{ | |
Name = "hibrifuncapp", | |
ResourceGroupName = rg.Name, | |
Location = rg.Location, | |
ServicePlanId = appServicePlan.Id, | |
AppSettings = new Dictionary<string, string>(), | |
StorageAccountName = functionStorageAccount.Name, | |
StorageAccountAccessKey = functionStorageAccount.SecondaryAccessKey, | |
SiteConfig = new LinuxFunctionAppSiteConfig | |
{ | |
ApplicationStack = new LinuxFunctionAppSiteConfigApplicationStack | |
{ | |
DotnetVersion = "6.0" | |
} | |
} | |
}; | |
var functionApp = new LinuxFunctionApp(this, "functionapp", functionAppConfig); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment