Skip to content

Commit

Permalink
added azure stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
RWejlgaard committed Oct 21, 2023
1 parent 1348577 commit b99a702
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ jobs:
with:
name: plan

- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Unlock encrypted files
run: |
export SECRET_PASS="${{ secrets.SECRET_PASS }}"
Expand Down
28 changes: 28 additions & 0 deletions azure_ad_applications.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
data "azuread_client_config" "current" {}

resource "azuread_application" "cloudflare_access" {
display_name = "Cloudflare Access"

required_resource_access {
resource_app_id = "00000003-0000-0000-c000-000000000000"
resource_access {
id = "e1fe6dd8-ba31-4d61-89e7-88639da4683d"
type = "Scope"
}
}

web {
redirect_uris = [
"https://pezsh.cloudflareaccess.com/cdn-cgi/access/callback"
]

implicit_grant {
access_token_issuance_enabled = false
id_token_issuance_enabled = false
}
}
}

resource "azuread_application_password" "cloudflare_access" {
application_object_id = azuread_application.cloudflare_access.object_id
}
9 changes: 9 additions & 0 deletions azure_ad_users.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "azuread_user" "rasmus" {
display_name = "Rasmus Wejlgaard"
user_principal_name = "[email protected]"
}

resource "azuread_user" "khanh" {
display_name = "Khanh Dang"
user_principal_name = "[email protected]"
}
5 changes: 5 additions & 0 deletions access.tf → cloudflare_access.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ resource "cloudflare_access_identity_provider" "azure_ad" {
account_id = cloudflare_account.this.id
name = "Azure AD"
type = "azureAD"
config {
client_id = azuread_application.cloudflare_access.application_id
client_secret = azuread_application_password.cloudflare_access.value
directory_id = data.azuread_client_config.current.tenant_id
}
}

resource "cloudflare_access_application" "alertmanager" {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ terraform {
cloudflare = {
source = "cloudflare/cloudflare"
}
azuread = {
source = "hashicorp/azuread"
}
}
backend "s3" { }
}

provider "cloudflare" {
email = local.secrets["cloudflare_email"]
api_key = local.secrets["cloudflare_api_key"]
}

provider "azuread" {
tenant_id = local.secrets["azure_tenant_id"]
}
Binary file modified secrets/backend.hcl.enc
Binary file not shown.
Binary file modified secrets/secrets.yml.enc
Binary file not shown.

0 comments on commit b99a702

Please sign in to comment.