Skip to content

Commit

Permalink
Add organization module
Browse files Browse the repository at this point in the history
  • Loading branch information
posquit0 committed Apr 19, 2024
1 parent 7376dab commit 7a7a65f
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/labeler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
":floppy_disk: group-rule":
- modules/group-rule/**/*

":floppy_disk: organization":
- modules/organization/**/*

":floppy_disk: user":
- modules/user/**/*
3 changes: 3 additions & 0 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
- color: "fbca04"
description: "This issue or pull request is related to group-rule module."
name: ":floppy_disk: group-rule"
- color: "fbca04"
description: "This issue or pull request is related to organization module."
name: ":floppy_disk: organization"
- color: "fbca04"
description: "This issue or pull request is related to user module."
name: ":floppy_disk: user"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Terraform module to manage all of things on Okta organization.
- [brand](./modules/brand/)
- [group](./modules/group/)
- [group-rule](./modules/group-rule/)
- [organization](./modules/organization/)
- [user](./modules/user/)


Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.2.0
42 changes: 42 additions & 0 deletions modules/organization/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# organization

This module creates following resources.

- `okta_security_notification_emails`

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.6 |
| <a name="requirement_okta"></a> [okta](#requirement\_okta) | >= 4.8 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_okta"></a> [okta](#provider\_okta) | 4.8.1 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [okta_security_notification_emails.this](https://registry.terraform.io/providers/okta/okta/latest/docs/resources/security_notification_emails) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_security_notification_email_preferences"></a> [security\_notification\_email\_preferences](#input\_security\_notification\_email\_preferences) | (Optional) A preferences for security notification emails. `security_notification_email_preferences` block as defined below.<br> (Optional) `report_on_suspicious_activity` - Whether to notify end users about suspicious<br> or unrecognized activity from their account. Defaults to `true`.<br> (Optional) `notify_on_factor_enrollment` - Whether to notify end users of any activity on their account related to MFA factor enrollment. Defaults to `true`.<br> (Optional) `notify_on_factor_reset` - Whether to notify end users that one or more factors have been reset for their account. Defaults to `true`.<br> (Optional) `notify_on_new_device` - Whether to notify end users about new sign-on activity. Defaults to `false`.<br> (Optional) `notify_on_password_changed` - Whether to notify end users that the password for their account has changed. Defaults to `true`. | <pre>object({<br> report_on_suspicious_activity = optional(bool, true)<br> notify_on_factor_enrollment = optional(bool, true)<br> notify_on_factor_reset = optional(bool, true)<br> notify_on_new_device = optional(bool, false)<br> notify_on_password_changed = optional(bool, true)<br> })</pre> | `{}` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_security_notification_email_preferences"></a> [security\_notification\_email\_preferences](#output\_security\_notification\_email\_preferences) | The preferences for security notification emails. |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
29 changes: 29 additions & 0 deletions modules/organization/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# locals {
# metadata = {
# package = "terraform-okta-modules"
# version = trimspace(file("${path.module}/../../VERSION"))
# module = basename(path.module)
# name = var.name
# }
# module_tags = {
# "module.terraform.io/package" = local.metadata.package
# "module.terraform.io/version" = local.metadata.version
# "module.terraform.io/name" = local.metadata.module
# "module.terraform.io/full-name" = "${local.metadata.package}/${local.metadata.module}"
# "module.terraform.io/instance" = local.metadata.name
# }
# }


###################################################
# Security Notification Preferences for Organization
###################################################

resource "okta_security_notification_emails" "this" {
report_suspicious_activity_enabled = var.security_notification_email_preferences.report_on_suspicious_activity

send_email_for_factor_enrollment_enabled = var.security_notification_email_preferences.notify_on_factor_enrollment
send_email_for_factor_reset_enabled = var.security_notification_email_preferences.notify_on_factor_reset
send_email_for_new_device_enabled = var.security_notification_email_preferences.notify_on_new_device
send_email_for_password_changed_enabled = var.security_notification_email_preferences.notify_on_password_changed
}
10 changes: 10 additions & 0 deletions modules/organization/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
output "security_notification_email_preferences" {
description = "The preferences for security notification emails."
value = {
report_on_suspicious_activity = okta_security_notification_emails.this.report_suspicious_activity_enabled
notify_on_factor_enrollment = okta_security_notification_emails.this.send_email_for_factor_enrollment_enabled
notify_on_factor_reset = okta_security_notification_emails.this.send_email_for_factor_reset_enabled
notify_on_new_device = okta_security_notification_emails.this.send_email_for_new_device_enabled
notify_on_password_changed = okta_security_notification_emails.this.send_email_for_password_changed_enabled
}
}
26 changes: 26 additions & 0 deletions modules/organization/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# variable "name" {
# description = "(Required) A name of the organization."
# type = string
# nullable = false
# }

variable "security_notification_email_preferences" {
description = <<EOF
(Optional) A preferences for security notification emails. `security_notification_email_preferences` block as defined below.
(Optional) `report_on_suspicious_activity` - Whether to notify end users about suspicious
or unrecognized activity from their account. Defaults to `true`.
(Optional) `notify_on_factor_enrollment` - Whether to notify end users of any activity on their account related to MFA factor enrollment. Defaults to `true`.
(Optional) `notify_on_factor_reset` - Whether to notify end users that one or more factors have been reset for their account. Defaults to `true`.
(Optional) `notify_on_new_device` - Whether to notify end users about new sign-on activity. Defaults to `false`.
(Optional) `notify_on_password_changed` - Whether to notify end users that the password for their account has changed. Defaults to `true`.
EOF
type = object({
report_on_suspicious_activity = optional(bool, true)
notify_on_factor_enrollment = optional(bool, true)
notify_on_factor_reset = optional(bool, true)
notify_on_new_device = optional(bool, false)
notify_on_password_changed = optional(bool, true)
})
default = {}
nullable = false
}
10 changes: 10 additions & 0 deletions modules/organization/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">= 1.6"

required_providers {
okta = {
source = "okta/okta"
version = ">= 4.8"
}
}
}

0 comments on commit 7a7a65f

Please sign in to comment.