-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(terraform)!: access backend behind firewall #261
Closed
Closed
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
69b74ae
feat: temporarily whitelite github runner IP
sebastianlolv 96bbb4b
feat: temporarily whitelite github runner IP
sebastianlolv d29bf4d
feat: temporarily whitelite github runner IP
sebastianlolv b8e98b5
feat: temporarily whitelite github runner IP
sebastianlolv 4e1e61b
feat: temporarily whitelite github runner IP
sebastianlolv 46655a2
feat: temporarily whitelite github runner IP
sebastianlolv 55deaec
Merge branch 'main' into public-ip-temp-whitelist
sebastianlolv 0e93bfc
merge
hknutsen 3dd1335
Merge branch 'main' into public-ip-temp-whitelist
hknutsen 2d4e4c7
add todos
hknutsen 4b445d6
wip
hknutsen b29443b
wip
hknutsen 404905b
wip
hknutsen 74809d5
wip
hknutsen 508a41f
wip
hknutsen 3dfa4fc
wip
hknutsen 7ea7235
wip
hknutsen 6877452
wip
hknutsen dc1cf57
wip
hknutsen b34125b
wip
hknutsen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,11 @@ on: | |
required: false | ||
default: "." | ||
|
||
subscription: | ||
description: The subscription to deploy in | ||
type: string | ||
required: true | ||
|
||
terraform_version: | ||
description: The version of Terraform to install. | ||
type: string | ||
|
@@ -67,6 +72,9 @@ env: | |
|
||
ENCRYPTION_PASSWORD: ${{ secrets.ENCRYPTION_PASSWORD }} | ||
|
||
resource_group_name: ${{ inputs.subscription }}-tfstate | ||
key_vault_name: kv-${{ inputs.subscription }}-${{ inputs.environment }} | ||
|
||
jobs: | ||
terraform-plan: | ||
name: Terraform Plan | ||
|
@@ -173,6 +181,24 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: 'Az login' | ||
uses: azure/login@v1 | ||
with: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
|
||
- name: Get GitHub Public IP | ||
id: github_public_ip | ||
uses: haythem/[email protected] | ||
|
||
- name: Add GitHub IP to Key Vault | ||
run: | | ||
az keyvault account network-rule add \ | ||
--resource-group "${{ env.resource_group_name }}" \ | ||
--name "${{ env.key_vault_name }}" \ | ||
--ip-address ${{ steps.github_public_ip.outputs.ipv4 }} >/dev/null | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
|
@@ -198,3 +224,10 @@ jobs: | |
uses: GeekyEggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af | ||
with: | ||
name: ${{ inputs.artifact_name }} | ||
|
||
- name: Revoke GitHub IP on Key Vault | ||
run: | | ||
az keyvault account network-rule remove \ | ||
--resource-group "${{ env.resource_group_name }}" \ | ||
--name "${{ env.key_vault_name }}" \ | ||
--ip-address ${{ steps.github_public_ip.outputs.ipv4 }} >/dev/null |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not just a duplicate of the secret
AZURE_SUBSCRIPTION_ID
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the subscription id on --resource-group tag inline command, if so, yes I think we can scrap that then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can rather rename it to project_name or something similar? Since we need to reference it in the key vault name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't even notice that we're talking about a Key Vault here, and not a Storage account 😅
How would this work if you're running a Terraform config with multiple or no Key Vaults? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea 😅 I think I might have read this wrong, looks like they whitelist it in the tfstate storage accounts when I look at Radix's version of it. 😅 I can turn it into something like what they have done.