This repository was archived by the owner on Jan 13, 2025. It is now read-only.
File tree 9 files changed +116
-11
lines changed
infrastructure/modules/aws/eks
9 files changed +116
-11
lines changed Original file line number Diff line number Diff line change
1
+ authentik_url = ""
2
+ authentik_api_key = ""
Original file line number Diff line number Diff line change
1
+ variable "authentik_url" {
2
+ description = " Authentik management URL"
3
+ }
4
+
5
+ variable "authentik_api_key" {
6
+ description = " Authentik management API key"
7
+ sensitive = true
8
+ }
Original file line number Diff line number Diff line change @@ -20,10 +20,10 @@ terraform {
20
20
21
21
// Provider configuration
22
22
23
- # provider "authentik" {
24
- # token = ""
25
- # url = ""
26
- # }
23
+ provider "authentik" {
24
+ url = var . authentik_url
25
+ token = var . authentik_api_key
26
+ }
27
27
28
28
# provider "vault" {
29
29
# address = ""
@@ -40,9 +40,9 @@ module "authentik" {
40
40
}
41
41
}
42
42
43
- module "vault" {
44
- source = " ./modules/vault"
45
- providers = {
46
- vault = vault
47
- }
48
- }
43
+ # module "vault" {
44
+ # source = "./modules/vault"
45
+ # providers = {
46
+ # vault = vault
47
+ # }
48
+ # }
Original file line number Diff line number Diff line change
1
+ data "authentik_flow" "default-implicit" {
2
+ slug = " default-provider-authorization-implicit-consent"
3
+ }
4
+
5
+ data "authentik_flow" "default-explicit" {
6
+ slug = " default-provider-authorization-explicit-consent"
7
+ }
8
+
9
+ data "authentik_scope_mapping" "scope-email" {
10
+ scope_name = " email"
11
+ name = " authentik default OAuth Mapping: OpenID 'email'"
12
+ }
13
+
14
+ data "authentik_scope_mapping" "scope-profile" {
15
+ scope_name = " profile"
16
+ name = " authentik default OAuth Mapping: OpenID 'profile'"
17
+ }
18
+
19
+ data "authentik_scope_mapping" "scope-openid" {
20
+ scope_name = " roles"
21
+ name = " authentik default OAuth Mapping: OpenID 'openid'"
22
+ }
Original file line number Diff line number Diff line change
1
+ resource "authentik_group" "students" {
2
+ name = " Presentium Students"
3
+ }
4
+
5
+ resource "authentik_group" "teachers" {
6
+ name = " Presentium Teachers"
7
+ parent = authentik_group. students . id
8
+ }
9
+
10
+ resource "authentik_group" "admins" {
11
+ name = " Presentium Admins"
12
+ parent = authentik_group. teachers . id
13
+ is_superuser = true
14
+ }
Original file line number Diff line number Diff line change
1
+ resource "authentik_scope_mapping" "scope-roles" {
2
+ name = " Presentium Roles"
3
+ scope_name = " roles"
4
+ expression = <<- EOT
5
+ roles = []
6
+ if ak_is_group_member(request.user, name="${ authentik_group . students . name } "):
7
+ roles.append("student")
8
+ if ak_is_group_member(request.user, name="${ authentik_group . teachers . name } "):
9
+ roles.append("teacher")
10
+ if ak_is_group_member(request.user, name="${ authentik_group . admins . name } "):
11
+ roles.append("admin")
12
+
13
+ return {
14
+ "roles": roles
15
+ }
16
+ EOT
17
+ }
Original file line number Diff line number Diff line change
1
+ resource "authentik_provider_oauth2" "presentium" {
2
+ name = " oidc-presentium"
3
+ client_id = " ca884da2-1542-46a7-be60-5c42a513451a"
4
+
5
+ authorization_flow = data. authentik_flow . default-explicit . id
6
+
7
+ redirect_uris = [
8
+ " https://app.presentium.ch/auth/oidc/callback" , # Production domain
9
+ " https://staging.presentium.ch/auth/oidc/callback" , # Staging domain
10
+ " https://dashboard-presentium.nuxt.dev/auth/oidc/callback" , # NuxtHub domain
11
+ " https://[\\ w-]+.dashboard-1as.pages.dev/auth/oidc/callback" , # PR / preview domains
12
+ ]
13
+
14
+ property_mappings = [
15
+ data . authentik_scope_mapping . scope-email . id ,
16
+ data . authentik_scope_mapping . scope-profile . id ,
17
+ data . authentik_scope_mapping . scope-openid . id ,
18
+ authentik_scope_mapping . scope-roles . id ,
19
+ ]
20
+ }
21
+
22
+ resource "authentik_application" "presentium" {
23
+ name = " Presentium"
24
+ slug = " presentium"
25
+ protocol_provider = authentik_provider_oauth2. presentium . id
26
+ meta_icon = " https://avatars.githubusercontent.com/u/174350723?s=4000&v=4"
27
+ }
Original file line number Diff line number Diff line change 48
48
49
49
RUN chmod +x /gitops-tools/* && ln -sf /gitops-tools/helm-plugins/helm-secrets/scripts/wrapper/helm.sh /usr/local/sbin/helm
50
50
51
- USER argocd
51
+ USER $ARGOCD_USER_ID
Original file line number Diff line number Diff line change @@ -14,6 +14,21 @@ module "vpc_cni_irsa" {
14
14
}
15
15
}
16
16
17
+ module "alb_controller_irsa" {
18
+ source = " terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
19
+
20
+ role_name = " PRES-ALB-CONTROLLER-${ upper (module. eks . cluster_name )} "
21
+
22
+ attach_load_balancer_controller_policy = true
23
+
24
+ oidc_providers = {
25
+ main = {
26
+ provider_arn = module.eks.oidc_provider_arn
27
+ namespace_service_accounts = [" kube-system:aws-load-balancer-controller" ]
28
+ }
29
+ }
30
+ }
31
+
17
32
module "sops_kms_irsa" {
18
33
source = " terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
19
34
You can’t perform that action at this time.
0 commit comments