diff --git a/Deployment/locals.tf b/Deployment/locals.tf index fe2c588f..8d3d2dd0 100644 --- a/Deployment/locals.tf +++ b/Deployment/locals.tf @@ -11,7 +11,7 @@ locals { vnet_link = "erp${local.env_name}2sap" private_connection = "/subscriptions/${var.subscription_id}/resourceGroups/erpfacade-${local.env_name}-rg/providers/Microsoft.Web/sites/erpfacade-${local.env_name}-api" mock_private_connection = "/subscriptions/${var.subscription_id}/resourceGroups/erpfacade-${local.env_name}-rg/providers/Microsoft.Web/sites/erpfacade-${local.env_name}-sapmockservice" - dns_resource_group = "engineering-rg" + dns_resource_group = "${var.dns_zone_rg}" zone_group = "erp${local.env_name}2sapzone" dns_zones = "privatelink.azurewebsites.net" tags = { diff --git a/Deployment/templates/continuous-deployment.yml b/Deployment/templates/continuous-deployment.yml index 8f9c2575..449da022 100644 --- a/Deployment/templates/continuous-deployment.yml +++ b/Deployment/templates/continuous-deployment.yml @@ -27,4 +27,5 @@ steps: TF_VAR_pe_vnet_name: $(peVnetName) TF_VAR_pe_subnet_name: $(peSubnetName) TF_VAR_pe_rg: $(peRG) + TF_VAR_dns_zone_rg: $(dnsZoneRG) \ No newline at end of file diff --git a/Deployment/variables.tf b/Deployment/variables.tf index af46810f..78d171e0 100644 --- a/Deployment/variables.tf +++ b/Deployment/variables.tf @@ -16,6 +16,10 @@ variable "hub_subscription_id" { type = string } +variable "dns_zone_rg" { + type = string +} + variable "sku_name" { type = map(any) default = { diff --git a/src/UKHO.ERPFacade.API/UKHO.ERPFacade.API.csproj b/src/UKHO.ERPFacade.API/UKHO.ERPFacade.API.csproj index 23e5b1af..7fa1d5a2 100644 --- a/src/UKHO.ERPFacade.API/UKHO.ERPFacade.API.csproj +++ b/src/UKHO.ERPFacade.API/UKHO.ERPFacade.API.csproj @@ -29,7 +29,7 @@ - + diff --git a/src/UKHO.ERPFacade.CleanUp.WebJob/UKHO.ERPFacade.CleanUp.WebJob.csproj b/src/UKHO.ERPFacade.CleanUp.WebJob/UKHO.ERPFacade.CleanUp.WebJob.csproj index 519a6508..04de53fc 100644 --- a/src/UKHO.ERPFacade.CleanUp.WebJob/UKHO.ERPFacade.CleanUp.WebJob.csproj +++ b/src/UKHO.ERPFacade.CleanUp.WebJob/UKHO.ERPFacade.CleanUp.WebJob.csproj @@ -29,7 +29,7 @@ - + diff --git a/src/UKHO.ERPFacade.Common/UKHO.ERPFacade.Common.csproj b/src/UKHO.ERPFacade.Common/UKHO.ERPFacade.Common.csproj index 69d8f884..5eb63ae5 100644 --- a/src/UKHO.ERPFacade.Common/UKHO.ERPFacade.Common.csproj +++ b/src/UKHO.ERPFacade.Common/UKHO.ERPFacade.Common.csproj @@ -16,7 +16,7 @@ 8603;8604;8618;8777;8602;8600;1591;1587;8601 - + diff --git a/src/UKHO.ERPFacade.EventAggregation.WebJob/UKHO.ERPFacade.EventAggregation.WebJob.csproj b/src/UKHO.ERPFacade.EventAggregation.WebJob/UKHO.ERPFacade.EventAggregation.WebJob.csproj index 9b53cc7e..affd2603 100644 --- a/src/UKHO.ERPFacade.EventAggregation.WebJob/UKHO.ERPFacade.EventAggregation.WebJob.csproj +++ b/src/UKHO.ERPFacade.EventAggregation.WebJob/UKHO.ERPFacade.EventAggregation.WebJob.csproj @@ -25,7 +25,7 @@ - + diff --git a/src/UKHO.SAP.MockAPIService/UKHO.SAP.MockAPIService.csproj b/src/UKHO.SAP.MockAPIService/UKHO.SAP.MockAPIService.csproj index 46cccc68..2b4bc714 100644 --- a/src/UKHO.SAP.MockAPIService/UKHO.SAP.MockAPIService.csproj +++ b/src/UKHO.SAP.MockAPIService/UKHO.SAP.MockAPIService.csproj @@ -19,7 +19,7 @@ - + diff --git a/tests/UKHO.ERPFacade.API.FunctionalTests/FunctionalTests/WebhookScenarios.cs b/tests/UKHO.ERPFacade.API.FunctionalTests/FunctionalTests/WebhookScenarios.cs index 8a3b65fb..18a2e54a 100644 --- a/tests/UKHO.ERPFacade.API.FunctionalTests/FunctionalTests/WebhookScenarios.cs +++ b/tests/UKHO.ERPFacade.API.FunctionalTests/FunctionalTests/WebhookScenarios.cs @@ -10,7 +10,7 @@ namespace UKHO.ERPFacade.API.FunctionalTests.FunctionalTests [TestFixture] public class WebhookScenarios { - private WebhookEndpoint WebhookEndpoint { get; set; } + private WebhookEndpoint _webhookEndpoint { get; set; } private readonly ADAuthTokenProvider _authToken = new(); private readonly string _projectDir = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory)); @@ -20,13 +20,13 @@ public class WebhookScenarios [SetUp] public void Setup() { - WebhookEndpoint = new WebhookEndpoint(); + _webhookEndpoint = new WebhookEndpoint(); } [Test(Description = "WhenValidEventInNewEncContentPublishedEventOptions_ThenWebhookReturns200OkResponse"), Order(0)] public async Task WhenValidEventInNewEncContentPublishedEventOptions_ThenWebhookReturns200OkResponse() { - var response = await WebhookEndpoint.OptionWebhookResponseAsync(await _authToken.GetAzureADToken(false)); + var response = await _webhookEndpoint.OptionWebhookResponseAsync(await _authToken.GetAzureADToken(false)); response.StatusCode.Should().Be(System.Net.HttpStatusCode.OK); } @@ -34,7 +34,7 @@ public async Task WhenValidEventInNewEncContentPublishedEventOptions_ThenWebhook public async Task WhenValidEventInNewEncContentPublishedEventReceivedWithValidToken_ThenWebhookReturns200OkResponse() { string filePath = Path.Combine(_projectDir, Config.TestConfig.PayloadFolder, Config.TestConfig.WebhookPayloadFileName); - var response = await WebhookEndpoint.PostWebhookResponseAsync(filePath, await _authToken.GetAzureADToken(false)); + var response = await _webhookEndpoint.PostWebhookResponseAsync(filePath, await _authToken.GetAzureADToken(false)); response.StatusCode.Should().Be(System.Net.HttpStatusCode.OK); } @@ -42,7 +42,7 @@ public async Task WhenValidEventInNewEncContentPublishedEventReceivedWithValidTo public async Task WhenValidEventInNewEncContentPublishedEventReceivedWithInvalidToken_ThenWebhookReturns401UnAuthorizedResponse() { string filePath = Path.Combine(_projectDir, Config.TestConfig.PayloadFolder, Config.TestConfig.WebhookPayloadFileName); - var response = await WebhookEndpoint.PostWebhookResponseAsync(filePath, "invalidToken_abcd"); + var response = await _webhookEndpoint.PostWebhookResponseAsync(filePath, "invalidToken_abcd"); response.StatusCode.Should().Be(System.Net.HttpStatusCode.Unauthorized); } @@ -50,7 +50,7 @@ public async Task WhenValidEventInNewEncContentPublishedEventReceivedWithInvalid public async Task WhenValidEventInNewEncContentPublishedEventReceivedWithTokenHavingNoRole_ThenWebhookReturns403ForbiddenResponse() { string filePath = Path.Combine(_projectDir, Config.TestConfig.PayloadFolder, Config.TestConfig.WebhookPayloadFileName); - var response = await WebhookEndpoint.PostWebhookResponseAsync(filePath, await _authToken.GetAzureADToken(true)); + var response = await _webhookEndpoint.PostWebhookResponseAsync(filePath, await _authToken.GetAzureADToken(true)); response.StatusCode.Should().Be(System.Net.HttpStatusCode.Forbidden); } @@ -110,7 +110,7 @@ public async Task WhenValidEventInNewEncContentPublishedEventReceivedWithValidTo Console.WriteLine("Scenario:" + payloadJsonFileName + "\n"); string filePath = Path.Combine(_projectDir, Config.TestConfig.PayloadFolder, payloadJsonFileName); string generatedXmlFolder = Path.Combine(_projectDir, Config.TestConfig.GeneratedXmlFolder); - RestResponse response = await WebhookEndpoint.PostWebhookResponseAsyncForXml(filePath, generatedXmlFolder, await _authToken.GetAzureADToken(false), permitState ); + RestResponse response = await _webhookEndpoint.PostWebhookResponseAsyncForXml(filePath, generatedXmlFolder, await _authToken.GetAzureADToken(false), permitState); response.StatusCode.Should().Be(System.Net.HttpStatusCode.OK); } @@ -134,10 +134,10 @@ public async Task WhenValidEventInNewEncContentPublishedEventReceivedWithValidTo public async Task WhenMandatoryAttributeIsEmptyOrNullInPayload_ThenWebhookReturnsInternalServerErrorResponse(string attributeName, int index) { string filePath = Path.Combine(_projectDir, Config.TestConfig.PayloadFolder, "MandatoryAttributeValidation.JSON"); - RestResponse response = await WebhookEndpoint.PostWebhookResponseForMandatoryAttributeValidation(filePath, await _authToken.GetAzureADToken(false), attributeName, index, "Remove"); + RestResponse response = await _webhookEndpoint.PostWebhookResponseForMandatoryAttributeValidation(filePath, await _authToken.GetAzureADToken(false), attributeName, index, "Remove"); response.StatusCode.Should().Be(System.Net.HttpStatusCode.InternalServerError); - response = await WebhookEndpoint.PostWebhookResponseForMandatoryAttributeValidation(filePath, await _authToken.GetAzureADToken(false), attributeName, index, "EmptyOrNull"); + response = await _webhookEndpoint.PostWebhookResponseForMandatoryAttributeValidation(filePath, await _authToken.GetAzureADToken(false), attributeName, index, "EmptyOrNull"); response.StatusCode.Should().Be(System.Net.HttpStatusCode.InternalServerError); } @@ -146,7 +146,7 @@ public async Task WhenPermitDecryptionFails_ThenWebhookReturnsInternalServerErro { string filePath = Path.Combine(_projectDir, Config.TestConfig.PayloadFolder, "NewCell.JSON"); const string permitString = "wwslkC9oG3rNcT4ZrgqX39pg9DuC9oSkBsl4kqiwr5h3nW6t0HUmlSaYhpdLEpO1"; //Invalid permit string to test permit decryption failure. - RestResponse response = await WebhookEndpoint.PostWebhookResponseAsyncForXml(filePath, "", await _authToken.GetAzureADToken(false), permitString); + RestResponse response = await _webhookEndpoint.PostWebhookResponseAsyncForXml(filePath, "", await _authToken.GetAzureADToken(false), permitString); response.StatusCode.Should().Be(System.Net.HttpStatusCode.InternalServerError); } } diff --git a/tests/UKHO.ERPFacade.API.FunctionalTests/UKHO.ERPFacade.API.FunctionalTests.csproj b/tests/UKHO.ERPFacade.API.FunctionalTests/UKHO.ERPFacade.API.FunctionalTests.csproj index 938dbb92..0d4e788a 100644 --- a/tests/UKHO.ERPFacade.API.FunctionalTests/UKHO.ERPFacade.API.FunctionalTests.csproj +++ b/tests/UKHO.ERPFacade.API.FunctionalTests/UKHO.ERPFacade.API.FunctionalTests.csproj @@ -28,7 +28,9 @@ - + + +