Skip to content

Commit 4905a2f

Browse files
authored
Merge pull request #1 from meshcloud/feature/access
chore: change replicator to access
2 parents be85820 + 807519b commit 4905a2f

File tree

10 files changed

+130
-48
lines changed

10 files changed

+130
-48
lines changed

.github/workflows/workflow.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1-
name: Terraform CI
1+
name: build
22
on:
33
push:
4+
branches: [ main ]
45
pull_request:
6+
branches: [ main ]
57
merge_group:
6-
types: [checks_requested]
78

89
jobs:
9-
build:
10-
uses: meshcloud/shared-workflows/.github/workflows/terraform-meshplatform-modules-build-workflow.yml@main
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: meshcloud/setup-collie@main
16+
17+
- uses: nixbuild/nix-quick-install-action@v26
18+
with:
19+
nix_on_tmpfs: true
20+
21+
- uses: rrbutani/use-nix-shell-action@v1
22+
with:
23+
devShell: .#github_actions # use a special github actions shell
24+
25+
- name: ensure all pre-commit hooks pass
26+
run: pre-commit run --all-files --show-diff-on-failure

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ After applying the configuration, you can retrieve the following outputs using `
9090
|------|-------------|------|---------|:--------:|
9191
| <a name="input_application_owners"></a> [application\_owners](#input\_application\_owners) | List of user principals that should be added as owners to the replicator service principal. | `list(string)` | `[]` | no |
9292
| <a name="input_create_password"></a> [create\_password](#input\_create\_password) | Create a password for the enterprise application. | `bool` | n/a | yes |
93-
| <a name="input_metering_additional_rules"></a> [metering\_additional\_rules](#input\_metering\_additional\_rules) | n/a | <pre>list(object({<br/> api_groups = list(string)<br/> resources = list(string)<br/> verbs = list(string)<br/> resource_names = optional(list(string))<br/> non_resource_urls = optional(list(string))<br/> }))</pre> | `[]` | no |
93+
| <a name="input_metering_additional_rules"></a> [metering\_additional\_rules](#input\_metering\_additional\_rules) | n/a | <pre>list(object({<br> api_groups = list(string)<br> resources = list(string)<br> verbs = list(string)<br> resource_names = optional(list(string))<br> non_resource_urls = optional(list(string))<br> }))</pre> | `[]` | no |
9494
| <a name="input_metering_enabled"></a> [metering\_enabled](#input\_metering\_enabled) | n/a | `bool` | `true` | no |
9595
| <a name="input_namespace"></a> [namespace](#input\_namespace) | name of the namespace where the replicator and metering components should be deployed | `string` | `"meshcloud"` | no |
96-
| <a name="input_replicator_additional_rules"></a> [replicator\_additional\_rules](#input\_replicator\_additional\_rules) | n/a | <pre>list(object({<br/> api_groups = list(string)<br/> resources = list(string)<br/> verbs = list(string)<br/> resource_names = optional(list(string))<br/> non_resource_urls = optional(list(string))<br/> }))</pre> | `[]` | no |
96+
| <a name="input_replicator_additional_rules"></a> [replicator\_additional\_rules](#input\_replicator\_additional\_rules) | n/a | <pre>list(object({<br> api_groups = list(string)<br> resources = list(string)<br> verbs = list(string)<br> resource_names = optional(list(string))<br> non_resource_urls = optional(list(string))<br> }))</pre> | `[]` | no |
9797
| <a name="input_replicator_enabled"></a> [replicator\_enabled](#input\_replicator\_enabled) | n/a | `bool` | `true` | no |
9898
| <a name="input_scope"></a> [scope](#input\_scope) | The scope of the service principal. The scope is usually the id of the aks subscription | `string` | n/a | yes |
9999
| <a name="input_service_principal_name"></a> [service\_principal\_name](#input\_service\_principal\_name) | Display name of the replicator service principal. | `string` | n/a | yes |
100-
| <a name="input_workload_identity_federation"></a> [workload\_identity\_federation](#input\_workload\_identity\_federation) | Enable workload identity federation instead of using a password by providing these additional settings. Usually you should receive the required settings when attempting to configure a platform with workload identity federation in meshStack. | `object({ issuer = string, replicator_subject = string })` | `null` | no |
100+
| <a name="input_workload_identity_federation"></a> [workload\_identity\_federation](#input\_workload\_identity\_federation) | Enable workload identity federation instead of using a password by providing these additional settings. Usually you should receive the required settings when attempting to configure a platform with workload identity federation in meshStack. | `object({ issuer = string, access_subject = string })` | `null` | no |
101101

102102
## Outputs
103103

default.nix

Lines changed: 0 additions & 35 deletions
This file was deleted.

flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
description = "Flake for terraform-aks-meshplatform";
3+
4+
inputs = {
5+
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.05";
6+
};
7+
8+
outputs = { self, nixpkgs }:
9+
10+
let
11+
# These tools are pre-installed in github actions, so we can save the time for installing them.
12+
github_actions_preinstalled = pkgs:
13+
with pkgs;
14+
[
15+
awscli2
16+
(azure-cli.withExtensions [ azure-cli.extensions.account ])
17+
nodejs
18+
];
19+
20+
# core packages required in CI and not preinstalled in github actions
21+
core_packages = pkgs:
22+
let
23+
tofu_terraform =
24+
pkgs.stdenv.mkDerivation {
25+
name = "tofu-terraform";
26+
phases = [ "installPhase" ];
27+
installPhase = ''
28+
mkdir -p $out/bin
29+
echo '#!/usr/bin/env sh' > $out/bin/terraform
30+
echo 'tofu "$@"' >> $out/bin/terraform
31+
chmod +x $out/bin/terraform
32+
'';
33+
};
34+
in
35+
with pkgs;
36+
[
37+
opentofu
38+
terragrunt
39+
tflint
40+
tfupdate
41+
terraform-docs
42+
tofu_terraform
43+
pre-commit
44+
];
45+
46+
importNixpkgs = system: import nixpkgs { inherit system; };
47+
48+
defaultShellForSystem = system:
49+
let
50+
pkgs = importNixpkgs system;
51+
in {
52+
default = pkgs.mkShell {
53+
name = "terraform-aks-meshplatform";
54+
packages = (github_actions_preinstalled pkgs) ++ (core_packages pkgs);
55+
};
56+
};
57+
58+
in {
59+
devShells = {
60+
aarch64-darwin = defaultShellForSystem "aarch64-darwin";
61+
x86_64-darwin = defaultShellForSystem "x86_64-darwin";
62+
x86_64-linux = defaultShellForSystem "x86_64-linux" // {
63+
github_actions =
64+
let
65+
pkgs = importNixpkgs "x86_64-linux";
66+
in
67+
pkgs.mkShell {
68+
name = "meshstack-hub-ghactions";
69+
packages = (core_packages pkgs);
70+
};
71+
};
72+
};
73+
};
74+
}

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ module "replicator_service_principal" {
1212
service_principal_name = var.service_principal_name
1313
create_password = var.create_password
1414
workload_identity_federation = var.workload_identity_federation == null ? null : {
15-
issuer = var.workload_identity_federation.issuer,
16-
replicator_subject = var.workload_identity_federation.replicator_subject
15+
issuer = var.workload_identity_federation.issuer,
16+
access_subject = var.workload_identity_federation.access_subject
1717
}
1818
application_owners = var.application_owners
1919
}

modules/meshcloud-replicator-service-principal/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ No modules.
3434
| <a name="input_create_password"></a> [create\_password](#input\_create\_password) | Create a password for the enterprise application. | `bool` | n/a | yes |
3535
| <a name="input_scope"></a> [scope](#input\_scope) | The scope of the service principal. The scope is usually the id of the aks subscription | `string` | n/a | yes |
3636
| <a name="input_service_principal_name"></a> [service\_principal\_name](#input\_service\_principal\_name) | Display name of the replicator service principal. | `string` | `null` | no |
37-
| <a name="input_workload_identity_federation"></a> [workload\_identity\_federation](#input\_workload\_identity\_federation) | Enable workload identity federation instead of using a password by providing these additional settings. Usually you should receive the required settings when attempting to configure a platform with workload identity federation in meshStack. | `object({ issuer = string, replicator_subject = string })` | `null` | no |
37+
| <a name="input_workload_identity_federation"></a> [workload\_identity\_federation](#input\_workload\_identity\_federation) | Enable workload identity federation instead of using a password by providing these additional settings. Usually you should receive the required settings when attempting to configure a platform with workload identity federation in meshStack. | `object({ issuer = string, access_subject = string })` | `null` | no |
3838

3939
## Outputs
4040

modules/meshcloud-replicator-service-principal/auth.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ resource "azuread_application_federated_identity_credential" "meshcloud_replicat
3636
display_name = var.service_principal_name
3737
audiences = ["api://AzureADTokenExchange"]
3838
issuer = var.workload_identity_federation.issuer
39-
subject = var.workload_identity_federation.replicator_subject
39+
subject = var.workload_identity_federation.access_subject
4040
}

modules/meshcloud-replicator-service-principal/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ variable "create_password" {
1212
variable "workload_identity_federation" {
1313
default = null
1414
description = "Enable workload identity federation instead of using a password by providing these additional settings. Usually you should receive the required settings when attempting to configure a platform with workload identity federation in meshStack."
15-
type = object({ issuer = string, replicator_subject = string })
15+
type = object({ issuer = string, access_subject = string })
1616
}
1717

1818
variable "application_owners" {

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ variable "create_password" {
5454
variable "workload_identity_federation" {
5555
default = null
5656
description = "Enable workload identity federation instead of using a password by providing these additional settings. Usually you should receive the required settings when attempting to configure a platform with workload identity federation in meshStack."
57-
type = object({ issuer = string, replicator_subject = string })
57+
type = object({ issuer = string, access_subject = string })
5858
}
5959

6060
variable "application_owners" {

0 commit comments

Comments
 (0)