Skip to content

Instantly share code, notes, and snippets.

@Bak-Jin-Hyeong
Last active September 2, 2022 01:08
Show Gist options
  • Save Bak-Jin-Hyeong/7558b7430a8ed5cb95e381f407e9c6d9 to your computer and use it in GitHub Desktop.
Save Bak-Jin-Hyeong/7558b7430a8ed5cb95e381f407e9c6d9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env pwsh
# I always put a file named "backend.tf" in the root modules.
# Also, I don't create the name "backend.tf" in the non-root module directory.
# It seems to be my own rule, but most other people seem to do the same.
Get-ChildItem 'backend.tf' -Recurse | `
Select-Object -ExpandProperty FullName | `
ForEach-Object { `
Write-Output $_; `
terraform "-chdir=$(Split-Path $_)" init -upgrade; `
terraform "-chdir=$(Split-Path $_)" providers lock `
-platform=linux_amd64 `
-platform=linux_arm64 `
-platform=windows_amd64 `
-platform=darwin_amd64 `
-platform=darwin_arm64 `
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment