Skip to content

feat: add login_style attribute to ory_project_config#89

Merged
KT-Doan merged 2 commits intomainfrom
feat/login-style
Mar 11, 2026
Merged

feat: add login_style attribute to ory_project_config#89
KT-Doan merged 2 commits intomainfrom
feat/login-style

Conversation

@KT-Doan
Copy link
Copy Markdown
Collaborator

@KT-Doan KT-Doan commented Mar 5, 2026

Description

Add support for toggling login flow style between unified and identifier_first via the login_style attribute on ory_project_config.

This maps to the API path /services/identity/config/selfservice/flows/login/style.

Related Issues

Fixes #87

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING guide
  • My code follows the existing code style
  • I have added tests that prove my fix/feature works
  • I have updated documentation as needed
  • All new and existing tests pass (make test)
  • I have run the linter (make format)

Testing

  • Unit tests — 3 new tests for buildPatches (identifier_first, unified, null)
  • Acceptance tests — create, import, update, and no-diff verified against staging
  • Manual testing — terraform plan, apply, import, destroy all verified
  • API fix confirmed — PATCH persists login_style and GET returns updated value on both staging and production

What Changed

File Change
resource.go Added LoginStyle field to model, schema attribute with OneOf validator, buildPatches entry, readProjectConfig entry
build_patches_test.go 3 new unit tests for login_style patch generation
resource_test.go New TestAccProjectConfigResource_loginStyle acceptance test
testdata/login_style.tf.tmpl Test config template
examples/resources/ory_project_config/resource.tf Example usage
templates/resources/project_config.md.tmpl Added login flow to coverage table
docs/resources/project_config.md Auto-regenerated

Usage

resource "ory_project_config" "main" {
  login_style     = "identifier_first"  # or "unified"
  enable_password = true
}

Copilot AI review requested due to automatic review settings March 5, 2026 07:27
@KT-Doan KT-Doan force-pushed the feat/login-style branch from 0ba48d4 to 194e412 Compare March 5, 2026 07:30
@KT-Doan KT-Doan self-assigned this Mar 5, 2026
@KT-Doan KT-Doan marked this pull request as draft March 5, 2026 07:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new optional login_style attribute to the ory_project_config Terraform resource, enabling configuration of Ory Kratos login flow style via the project config JSON Patch API.

Changes:

  • Adds login_style to the project config resource model + schema (validated as unified or identifier_first) and maps it to /services/identity/config/selfservice/flows/login/style.
  • Extends patch-building and project-config reading logic to write/read the login style.
  • Adds unit + acceptance tests, updates docs/templates, and provides example + manual test configs.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/resources/projectconfig/resource.go Adds LoginStyle field, schema attribute, JSON patch generation, and read-back into state.
internal/resources/projectconfig/build_patches_test.go Unit tests verifying JSON Patch generation for login_style (identifier_first/unified/null).
internal/resources/projectconfig/resource_test.go Adds acceptance coverage for create/import/update/no-diff behavior for login_style.
internal/resources/projectconfig/testdata/login_style.tf.tmpl Acceptance test config template for login_style.
examples/resources/ory_project_config/resource.tf Example showing identifier-first login configuration.
templates/resources/project_config.md.tmpl Documents “Login flow” coverage category.
docs/resources/project_config.md Regenerated docs including the new attribute and example snippet.
test/manual/login_style/main.tf Manual test config for applying login_style.
test/manual/login_style/README.md Manual test instructions for create/update/import/destroy workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Add support for toggling login flow style between 'unified' and
'identifier_first' via the login_style attribute on ory_project_config.

This maps to the API path /services/identity/config/selfservice/flows/login/style.

Closes #87
The default login_style is "unified" — added this to the schema
description, example comments, and generated docs.
@KT-Doan KT-Doan marked this pull request as ready for review March 11, 2026 06:30
Copilot AI review requested due to automatic review settings March 11, 2026 06:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@KT-Doan KT-Doan merged commit fd0d6d9 into main Mar 11, 2026
17 checks passed
@KT-Doan KT-Doan deleted the feat/login-style branch March 20, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support toggling login style via terraform project configuration

3 participants