Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create duplication of common/max folder and name it waf-aligned (+ update serviceShort *waf) #4192

Closed
Tracked by #4183
eriqua opened this issue Nov 5, 2023 · 5 comments · Fixed by #4193
Closed
Tracked by #4183
Assignees

Comments

@eriqua
Copy link
Contributor

eriqua commented Nov 5, 2023

# Generate WAF folder
	
$testFolderPaths=(Get-ChildItem -Filter 'e2e' -Directory -Recurse).FullName
foreach ($testFolderPath in $testFolderPaths) {
	$wafFolderPath = Join-Path $testFolderPath 'waf-aligned'
	if (-not (Test-Path $wafFolderPath)) {
        # Duplicate 'max' test folder
        $null = New-Item -Path $wafFolderPath -ItemType 'Directory' -Force
        $maxFolderPath = Join-Path $testFolderPath 'max'
		if (Test-Path $maxFolderPath) {
			$null = Copy-Item -Path "$maxFolderPath/*" -Destination $wafFolderPath -Recurse
		}
    }
}

# Update serviceShort & metadata

$wafFolderPaths=(Get-ChildItem -Filter 'waf-aligned' -Directory -Recurse).FullName
foreach ($testFolderPath in $wafFolderPaths) {
	$testContent = Get-Content (Join-Path $testFolderPath 'main.test.bicep') -Raw
    $testContent = $testContent -replace "(param serviceShort string = '[a-zA-Z]+)max'", ("`$1{0}'" -f 'waf')
	$testContent = $testContent -replace "metadata name = 'Using large parameter set'", "metadata name = 'WAF-aligned'"
	$testContent = $testContent -replace "metadata description = 'This instance deploys the module with most of its features enabled.'", "metadata description = 'This instance deploys the module in alignment with the best-practices of the Azure Well-Architected Framework.'"
	$null = Set-Content (Join-Path $testFolderPath 'main.test.bicep') -Value $testContent -Force -NoNewline
}
@eriqua eriqua self-assigned this Nov 5, 2023
@AlexanderSehr
Copy link
Contributor

Question @eriqua, should we do any scripted changes here, for example remove role assignments, if any?

@eriqua
Copy link
Contributor Author

eriqua commented Nov 5, 2023

Not a bad idea at all. Should we take that in a separate issue? Just because the PR is ready and I'd expect some time to choose what to remove if present.

@AlexanderSehr
Copy link
Contributor

@eriqua, I think the value of the PR is limited if it's simple copy (and updated prefix). However, I guess it is an acceptable middle-step, so I'll see to review it.

@eriqua
Copy link
Contributor Author

eriqua commented Nov 6, 2023

@eriqua, I think the value of the PR is limited if it's simple copy (and updated prefix). However, I guess it is an acceptable middle-step, so I'll see to review it.

Duplication, serviceShort and metadata. That's what the module update script would have done at module level anyway so I'd disagree on the PR value :)

@AlexanderSehr
Copy link
Contributor

The original yes. The suggestion would have been to alter it 😏 but I can take care of that after

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants