feat: add code_mfa_enabled support to ory_project_config#126
Closed
feat: add code_mfa_enabled support to ory_project_config#126
Conversation
Add the missing `code_mfa_enabled` attribute to the `ory_project_config` resource, allowing users to configure the code method as a second factor for MFA via Terraform. Closes #122
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Terraform support for configuring the Ory “code” self-service method as an MFA second factor via a new code_mfa_enabled attribute on ory_project_config.
Changes:
- Extend the project config resource model/schema with
code_mfa_enabled. - Wire read/write mapping to Ory config paths for
selfservice.methods.code.mfa_enabled. - Add acceptance coverage plus update examples/docs to demonstrate the new flag.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/resources/projectconfig/testdata/code_mfa.tf.tmpl | Adds a test template exercising code_mfa_enabled. |
| internal/resources/projectconfig/resource_test.go | Adds an acceptance test that creates/updates/plans code_mfa_enabled. |
| internal/resources/projectconfig/resource.go | Adds the model field, schema attribute, and read/write mappings for code_mfa_enabled. |
| examples/resources/ory_project_config/resource.tf | Documents usage of code_mfa_enabled in an example config. |
| docs/resources/project_config.md | Updates generated docs and attribute list to include code_mfa_enabled. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+182
to
+186
| "enable_code", "code_mfa_enabled", | ||
| "cors_enabled", "password_min_length", | ||
| "smtp_connection_uri", | ||
| }, | ||
| }, |
| "code_mfa_enabled": schema.BoolAttribute{ | ||
| Description: "Enable the code method as a second factor for MFA. " + | ||
| "When enabled, users can use one-time codes as a second authentication factor.", | ||
| Optional: true, |
| @@ -0,0 +1,4 @@ | |||
| resource "ory_project_config" "test" { | |||
| enable_code = true | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add the missing
code_mfa_enabledattribute to theory_project_configresource, allowing users to configure the code method as a second factor for MFA via Terraform.This was reported in #122 — the
mfa_enabledsetting underselfservice->methods->codewas not exposed in the provider.Related Issues
Fixes #122
Type of Change
Checklist
make test)make format)Testing
Changes
CodeMFAEnabledfield (tfsdk:"code_mfa_enabled")code_mfa_enabledboolean attribute with description/services/identity/config/selfservice/methods/code/mfa_enabledselfservice.methods.code.mfa_enabledTestAccProjectConfigResource_codeMFAwith create, import, update, and no-diff verification stepsory_project_configexample to showcode_mfa_enabledusagemake formatAcceptance Test Results
Pre-commit Checks
make build— ✅make format— ✅ (0 lint issues)make test-short— ✅ (all unit tests pass)make sec— ✅ (govulncheck, gosec, gitleaks all clean)make sec-trivy— ✅ (no vulnerabilities)Usage