Skip to content

Commit 9d84cd7

Browse files
authored
Merge pull request #11 from lucdew/v5.2.0
keycloak terraform provider v5.2.0 support
2 parents e765d00 + d599bde commit 9d84cd7

File tree

66 files changed

+2581
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2581
-302
lines changed

.github/dependabot.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: 2
2+
updates:
3+
# Go-Module Updates
4+
- package-ecosystem: "gomod"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
open-pull-requests-limit: 5
9+
labels:
10+
- "dependencies"
11+
- "go"
12+
13+
# GitHub Actions Updates
14+
- package-ecosystem: "github-actions"
15+
directory: "/.github/workflows/"
16+
schedule:
17+
interval: "weekly"
18+
open-pull-requests-limit: 5
19+
labels:
20+
- "dependencies"
21+
- "github-actions"
22+
23+
# Gradle (Java) Updates
24+
- package-ecosystem: "gradle"
25+
directory: "/custom-user-federation-example/"
26+
schedule:
27+
interval: "weekly"
28+
open-pull-requests-limit: 5
29+
labels:
30+
- "dependencies"
31+
- "java"

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- name: Wait for acceptance tests
1414
id: wait
15-
uses: "WyriHaximus/[email protected]"
15+
uses: "WyriHaximus/github-action-wait-for-status@a0d59308face45c8229ad5aef809d6df5a0c7620" # version v1.8.0
1616
with:
1717
ignoreActions: Wait for acceptance tests
1818
checkInterval: 30
@@ -38,7 +38,7 @@ jobs:
3838

3939
- name: Import GPG key
4040
id: import_gpg
41-
uses: crazy-max/ghaction-import-gpg@v6
41+
uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # version v6.3.0
4242
with:
4343
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
4444
passphrase: ${{ secrets.GPG_PASSPHRASE }}
@@ -58,7 +58,7 @@ jobs:
5858
echo "name=NOTES::${tmp}/release-notes.md" >> $GITHUB_OUTPUT
5959
6060
- name: GoReleaser
61-
uses: goreleaser/goreleaser-action@v6
61+
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # version v6.3.0
6262
with:
6363
args: release --clean --release-notes=${{ steps.build-release-notes.outputs.NOTES }}
6464
env:

.github/workflows/test.yml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,6 @@ jobs:
3434
make vet
3535
make fmtcheck
3636
37-
# we only want to run tests if any code changes (not for README or docs changes)
38-
- name: Check Changed Files
39-
id: files
40-
uses: tj-actions/changed-files@v45
41-
with:
42-
files: |
43-
.github
44-
go.mod
45-
go.sum
46-
main.go
47-
keycloak
48-
provider
49-
scripts
50-
5137
outputs:
5238
code-files-changed: steps.files.outputs.any_changed
5339

@@ -66,6 +52,7 @@ jobs:
6652
strategy:
6753
matrix:
6854
keycloak-version:
55+
- '26.1.4'
6956
- '26.0.8'
7057
- '25.0.6'
7158
- '24.0.5'
@@ -86,13 +73,23 @@ jobs:
8673
cache: true
8774

8875
- name: Setup Terraform
89-
uses: hashicorp/setup-terraform@v3
76+
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # version v3.1.2
9077
with:
9178
terraform_wrapper: false
92-
terraform_version: 1.9.8
79+
terraform_version: 1.11.1
80+
81+
- name: Setup Gradle
82+
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # version v4.3.1
83+
- name: Build user-federation-example with Gradle
84+
run: make user-federation-example
9385

9486
- name: Start Keycloak Container
9587
run: |
88+
MOUNT_FEDERATION_EXAMPLE_VOLUME=""
89+
if [[ "${{ matrix.keycloak-version }}" == "26.1.4" ]]; then
90+
MOUNT_FEDERATION_EXAMPLE_VOLUME="-v $PWD/custom-user-federation-example/build/libs/custom-user-federation-example-all.jar:/opt/keycloak/providers/custom-user-federation-example-all.jar:z"
91+
fi
92+
9693
docker run -d --name keycloak \
9794
-p 8080:8080 \
9895
-e KC_DB=dev-mem \
@@ -101,6 +98,7 @@ jobs:
10198
-e KEYCLOAK_ADMIN_PASSWORD=password \
10299
-e KC_FEATURES=preview \
103100
-v $PWD/provider/misc:/opt/keycloak/misc:z \
101+
$MOUNT_FEDERATION_EXAMPLE_VOLUME \
104102
quay.io/keycloak/keycloak:${{ matrix.keycloak-version }} start-dev
105103
106104
- name: Initialize Keycloak

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ terraform-provider-keycloak_*
1414
*.out
1515

1616
.idea/
17+
.vscode/
1718
.terraform/
1819
terraform.d/
1920
.terraform.lock.hcl

CHANGELOG.md

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,67 @@
1-
## 5.1.1 (January 31, 2025)
1+
## 5.2.0 (April 14, 2025)
2+
3+
FEATURES:
4+
5+
* Feature/423 add hardcoded attribute mapper by @angeloxx in https://github.com/keycloak/terraform-provider-keycloak/pull/950
6+
* feat: Add option to configure always_display_in_console for clients by @mchittka in https://github.com/keycloak/terraform-provider-keycloak/pull/1114
7+
* Feature/keycloak_required_action config values by @laureat-natzka in https://github.com/keycloak/terraform-provider-keycloak/pull/996
8+
* feat: add all supported alogithms for rsa-enc keystore by @tboerger in https://github.com/keycloak/terraform-provider-keycloak/pull/1092
9+
* feat: add consent required flag on saml clients by @frpicard in https://github.com/keycloak/terraform-provider-keycloak/pull/1130
10+
* 1093 added support for KC26.1.0 by @sschu in https://github.com/keycloak/terraform-provider-keycloak/pull/1094
11+
* feat: add openid_client_authorization_client_scope_policy resource by @fitbeard in https://github.com/keycloak/terraform-provider-keycloak/pull/1128
12+
* feat: add realm translation resource by @jonathandavies-CS in https://github.com/keycloak/terraform-provider-keycloak/pull/1123
13+
* 1149 update to KC26.1.4 by @sschu in https://github.com/keycloak/terraform-provider-keycloak/pull/1150
14+
* Add tests for saml aggregate attributes by @robson90 in https://github.com/keycloak/terraform-provider-keycloak/pull/1171
15+
* Allow the alias of Google IdP to be set by @irby in https://github.com/keycloak/terraform-provider-keycloak/pull/1177
16+
* feat: add identity provider hardcoded group mapper by @gkfabs in https://github.com/keycloak/terraform-provider-keycloak/pull/886
17+
* feat: Support extra_origins in web_authn_policy and web_authn_passwordless_policy by @thomasdarimont in https://github.com/keycloak/terraform-provider-keycloak/pull/1173
218

319
IMPROVEMENTS:
420

5-
* 1100 run ci on release branches ([#1102](https://github.com/keycloak/terraform-provider-keycloak/pull/1102))
21+
* 1100 run ci on release branches by @sschu in https://github.com/keycloak/terraform-provider-keycloak/pull/1101
22+
* Adds support for the ExcludeIssuerFromAuthResponse option on OpenIdClient by @sebght in https://github.com/keycloak/terraform-provider-keycloak/pull/934
23+
* chore(deps): bump golang.org/x/net from 0.33.0 to 0.36.0 by @dependabot in https://github.com/keycloak/terraform-provider-keycloak/pull/1145
24+
* Fixed SHA commit values for non-GH GH actions by @sschu in https://github.com/keycloak/terraform-provider-keycloak/pull/1151
25+
* Create dependabot.yml by @sschu in https://github.com/keycloak/terraform-provider-keycloak/pull/1152
26+
* chore(deps): bump com.gradleup.shadow from 8.3.0 to 8.3.6 in /custom-user-federation-example by @dependabot in https://github.com/keycloak/terraform-provider-keycloak/pull/1157
27+
* Feature/update go 1.23 by @sschu in https://github.com/keycloak/terraform-provider-keycloak/pull/1158
28+
* chore(deps): bump org.jetbrains.kotlin.jvm from 2.0.20 to 2.1.10 in /custom-user-federation-example by @dependabot in https://github.com/keycloak/terraform-provider-keycloak/pull/1156
29+
* chore(deps): bump org.jetbrains.kotlin.jvm from 2.1.10 to 2.1.20 in /custom-user-federation-example by @dependabot in https://github.com/keycloak/terraform-provider-keycloak/pull/1160
30+
* fix: reuse TCP Connection by @Filirom1 in https://github.com/keycloak/terraform-provider-keycloak/pull/1163
31+
* Retry on timeout, when server doesn't respond by @Filirom1 in https://github.com/keycloak/terraform-provider-keycloak/pull/1161
32+
* chore(deps): bump crazy-max/ghaction-import-gpg from 6.2.0 to 6.3.0 in /.github/workflows by @dependabot in https://github.com/keycloak/terraform-provider-keycloak/pull/1168
33+
* chore(deps): bump gradle/actions from 4.3.0 to 4.3.1 in /.github/workflows by @dependabot in https://github.com/keycloak/terraform-provider-keycloak/pull/1167
34+
* chore(deps): bump golang.org/x/net from 0.37.0 to 0.38.0 by @dependabot in https://github.com/keycloak/terraform-provider-keycloak/pull/1165
35+
* chore(deps): bump goreleaser/goreleaser-action from 6.2.1 to 6.3.0 in /.github/workflows by @dependabot in https://github.com/keycloak/terraform-provider-keycloak/pull/1166
36+
* Increase MaxIdleConnsPerHost in http.Transport by @Filirom1 in https://github.com/keycloak/terraform-provider-keycloak/pull/1169
37+
* chore(deps): bump golang.org/x/net from 0.38.0 to 0.39.0 by @dependabot in https://github.com/keycloak/terraform-provider-keycloak/pull/1183
638

739
BUG FIXES:
840

9-
* 1091 fixed provider crash with initial_login set to false ([#1103](https://github.com/keycloak/terraform-provider-keycloak/pull/1103))
10-
* 1099 fix multi-valued user attributes cannot be enabled by ([#1107](https://github.com/keycloak/terraform-provider-keycloak/pull/1107))
41+
* 1091 fixed provider crash with initial_login set to false by @sschu in https://github.com/keycloak/terraform-provider-keycloak/pull/1097
42+
* 1099 fix multi-valued user attributes cannot be enabled by @sschu in https://github.com/keycloak/terraform-provider-keycloak/pull/1106
43+
* doc: fix token exchange doc urls by @emouty in https://github.com/keycloak/terraform-provider-keycloak/pull/1105
44+
* fix: fix the wrong error return value by @drawdrop in https://github.com/keycloak/terraform-provider-keycloak/pull/1134
45+
* fix: Render json `null` to indicate an empty value of type KeycloakSliceHashDelimited (#1142). by @thomasdarimont in https://github.com/keycloak/terraform-provider-keycloak/pull/1144
46+
* 1146 removed vulnerable github action tj-actions/changed-files by @sschu in https://github.com/keycloak/terraform-provider-keycloak/pull/1147
47+
* fix: Typo in realm_keys.md by @simonregn in https://github.com/keycloak/terraform-provider-keycloak/pull/1174
48+
49+
Huge thanks to all the individuals who have contributed towards this release:
50+
51+
- [@angeloxx](https://github.com/angeloxx)
52+
- [@mchittka](https://github.com/mchittka)
53+
- [@laureat-natzka](https://github.com/laureat-natzka)
54+
- [@tboerger](https://github.com/tboerger)
55+
- [@frpicard](https://github.com/frpicard)
56+
- [@fitbeard](https://github.com/fitbeard)
57+
- [@jonathandavies-CS](https://github.com/jonathandavies-CS)
58+
- [@robson90](https://github.com/robson90)
59+
- [@irby](https://github.com/irby)
60+
- [@gkfabs](https://github.com/gkfabs)
61+
- [@Filirom1](https://github.com/Filirom1)
62+
- [@emouty](https://github.com/emouty)
63+
- [@drawdrop](https://github.com/drawdrop)
64+
- [@simonregn](https://github.com/simonregn)
1165

1266
## 5.1.0 (January 24, 2025)
1367

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ This provider will officially support the latest three major versions of Keycloa
5555

5656
The following versions are used when running acceptance tests in CI:
5757

58-
- 26.0.8 (latest)
58+
- 26.1.4 (latest)
59+
- 26.0.8
5960
- 25.0.6
6061
- 24.0.5
6162
- 23.0.7
@@ -78,7 +79,7 @@ build you can use the `linux_amd64` build as long as `libc6-compat` is installed
7879

7980
## Development
8081

81-
This project requires Go 1.22 and Terraform 1.4.1.
82+
This project requires Go 1.22 and Terraform 1.11.1.
8283
This project uses [Go Modules](https://github.com/golang/go/wiki/Modules) for dependency management, which allows this project to exist outside an existing GOPATH.
8384

8485
After cloning the repository, you can build the project by running `make build`.

custom-user-federation-example/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
plugins {
2-
id 'org.jetbrains.kotlin.jvm' version '2.0.20'
3-
id 'com.gradleup.shadow' version '8.3.0'
2+
id 'org.jetbrains.kotlin.jvm' version '2.1.20'
3+
id 'com.gradleup.shadow' version '8.3.6'
44
id 'java-library'
55
}
66

77
ext {
8-
keycloakVersion = '26.0.8'
8+
keycloakVersion = '26.1.4'
99
}
1010

1111
dependencies {

docker-compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,21 @@ services:
1414
environment:
1515
LDAP_PORT_NUMBER: 389
1616
keycloak:
17-
image: quay.io/keycloak/keycloak:26.0.8
17+
image: quay.io/keycloak/keycloak:26.1.4
1818
command: --verbose start-dev --features=preview
1919
depends_on:
2020
- postgres
2121
- openldap
2222
environment:
2323
- KC_BOOTSTRAP_ADMIN_USERNAME=keycloak
2424
- KC_BOOTSTRAP_ADMIN_PASSWORD=password
25-
- KC_LOG_LEVEL=INFO
25+
- KC_LOG_LEVEL=INFO,org.keycloak:debug
2626
- KC_DB=postgres
2727
- KC_DB_URL_HOST=postgres
2828
- KC_DB_URL_PORT=5432
2929
- KC_DB_URL_DATABASE=keycloak
3030
- KC_DB_USERNAME=keycloak
3131
- KC_DB_PASSWORD=password
32-
- KC_LOG_LEVEL=INFO
3332
- KC_LOG_CONSOLE_COLOR=true
3433
- KC_FEATURES=preview
3534
- QUARKUS_HTTP_ACCESS_LOG_ENABLED=true

docs/data-sources/realm_keys.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ resource "keycloak_realm" "realm" {
2121
}
2222
2323
data "keycloak_realm_keys" "realm_keys" {
24-
realm_id = keycloak_realm.realm
24+
realm_id = keycloak_realm.realm.id
2525
algorithms = ["AES", "RS256"]
2626
status = ["ACTIVE", "PASSIVE"]
2727
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
page_title: "keycloak_hardcoded_attribute_mapper Resource"
3+
---
4+
5+
# keycloak_hardcoded_attribute_mapper Resource
6+
7+
Allows for creating and managing hardcoded attribute mappers for Keycloak users federated via LDAP.
8+
9+
The user model hardcoded attribute mapper will set the specified value to the attribute.
10+
11+
12+
## Example Usage
13+
14+
```hcl
15+
resource "keycloak_realm" "realm" {
16+
realm = "my-realm"
17+
enabled = true
18+
}
19+
20+
resource "keycloak_ldap_user_federation" "ldap_user_federation" {
21+
name = "openldap"
22+
realm_id = keycloak_realm.realm.id
23+
24+
username_ldap_attribute = "cn"
25+
rdn_ldap_attribute = "cn"
26+
uuid_ldap_attribute = "entryDN"
27+
user_object_classes = [
28+
"simpleSecurityObject",
29+
"organizationalRole"
30+
]
31+
32+
connection_url = "ldap://openldap"
33+
users_dn = "dc=example,dc=org"
34+
bind_dn = "cn=admin,dc=example,dc=org"
35+
bind_credential = "admin"
36+
37+
sync_registrations = true
38+
}
39+
40+
resource "keycloak_hardcoded_attribute_mapper" "email_verified" {
41+
realm_id = keycloak_realm.realm.id
42+
ldap_user_federation_id = keycloak_ldap_user_federation.ldap_user_federation.id
43+
name = "email_verified"
44+
attribute_name = "email_verified"
45+
attribute_value = "true"
46+
}
47+
```
48+
49+
## Argument Reference
50+
51+
- `realm_id` - (Required) The realm that this LDAP mapper will exist in.
52+
- `ldap_user_federation_id` - (Required) The ID of the LDAP user federation provider to attach this mapper to.
53+
- `name` - (Required) Display name of this mapper when displayed in the console.
54+
- `attribute_name` - (Required) The name of the user model attribute to set.
55+
- `attribute_value` - (Required) The value to set to model attribute. You can hardcode any value like 'foo'.
56+
57+
## Import
58+
59+
LDAP mappers can be imported using the format `{{realm_id}}/{{ldap_user_federation_id}}/{{attribute__mapper_id}}`.
60+
The ID of the LDAP user federation provider and the mapper can be found within the Keycloak GUI, and they are typically GUIDs.
61+
62+
Example:
63+
64+
```bash
65+
$ terraform import keycloak_hardcoded_attribute_mapper.email_verified my-realm/af2a6ca3-e4d7-49c3-b08b-1b3c70b4b860/3d923ece-1a91-4bf7-adaf-3b82f2a12b67
66+
```

0 commit comments

Comments
 (0)