public AzureStorageTestEnvironment(IMessageSink messageSink) { var solutionRoot = SolutionPaths.Root; var terraformResourceDirectory = Path.Combine(solutionRoot, "build", "terraform", "azure", "storage"); var credentials = AzureCredentials.Instance; // don't try to run terraform if not authenticated. if (credentials is Unauthenticated) { return; } _terraform = new TerraformResources(terraformResourceDirectory, credentials, messageSink); var machineName = Environment.MachineName.ToLowerInvariant(); if (machineName.Length > 66) { machineName = machineName.Substring(0, 66); } _variables = new Dictionary <string, string> { ["resource_group"] = $"dotnet-{machineName}-storage-test", ["storage_account_name"] = "dotnet" + Guid.NewGuid().ToString("N").Substring(0, 18), }; _terraform.Init(); _terraform.Apply(_variables); StorageAccountConnectionString = _terraform.Output("connection_string"); StorageAccountConnectionStringProperties = ParseConnectionString(StorageAccountConnectionString); }
public AzureServiceBusTestEnvironment(IMessageSink messageSink) { var solutionRoot = SolutionPaths.Root; var terraformResourceDirectory = Path.Combine(solutionRoot, "build", "terraform", "azure", "service_bus"); var credentials = AzureCredentials.Instance; // don't try to run terraform if not authenticated. if (credentials is Unauthenticated) { return; } _terraform = new TerraformResources(terraformResourceDirectory, credentials, messageSink); var resourceGroupName = AzureResources.CreateResourceGroupName("service-bus-test"); _variables = new Dictionary <string, string> { ["resource_group"] = resourceGroupName, ["servicebus_namespace"] = "dotnet-" + Guid.NewGuid() }; _terraform.Init(); _terraform.Apply(_variables); ServiceBusConnectionString = _terraform.Output("connection_string"); ServiceBusConnectionStringProperties = ServiceBusConnectionStringProperties.Parse(ServiceBusConnectionString); }
public AzureCosmosDbTestEnvironment(IMessageSink messageSink) { var solutionRoot = SolutionPaths.Root; var terraformResourceDirectory = Path.Combine(solutionRoot, "build", "terraform", "azure", "cosmosdb"); var credentials = AzureCredentials.Instance; // don't try to run terraform if not authenticated. if (credentials is Unauthenticated) { return; } _terraform = new TerraformResources(terraformResourceDirectory, credentials, messageSink); var resourceGroupName = AzureResources.CreateResourceGroupName("cosmosdb-test"); _variables = new Dictionary <string, string> { ["resource_group"] = resourceGroupName, ["cosmos_db_account_name"] = "dotnet" + Guid.NewGuid().ToString("N").Substring(0, 18), }; _terraform.Init(); _terraform.Apply(_variables); Endpoint = _terraform.Output("endpoint"); PrimaryMasterKey = _terraform.Output("primary_master_key"); }