Skip to content

Commit 06fad5d

Browse files
authored
Add saml identity support (#147)
* Add SAML identity support * Update release documentation
1 parent 00ee3c8 commit 06fad5d

File tree

13 files changed

+567
-17
lines changed

13 files changed

+567
-17
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
## UNRELEASED
22

3+
## 0.9.4 (August 14, 2023)
4+
35
NOTES:
46

7+
* Add support for managing a SAML identity source. [#140](https://github.com/gomorpheus/terraform-provider-morpheus/issues/140)
8+
* Add support for managing user roles. [#114](https://github.com/gomorpheus/terraform-provider-morpheus/issues/114)
9+
510
FEATURES:
611

712
* **New Data Source:** `morpheus_catalog_item_type`
813
* **New Data Source:** `morpheus_permission_set`
914
* **New Data Source:** `morpheus_security_package`
1015
* **New Data Source:** `morpheus_vdi_pool`
1116
* **New Resource:** `morpheus_ipv4_ip_pool`
17+
* **New Resource:** `morpheus_saml_identity_source`
1218
* **New Resource:** `morpheus_security_package`
1319
* **New Resource:** `morpheus_servicenow_integration`
1420
* **New Resource:** `morpheus_user_role`
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
page_title: "morpheus_saml_identity_source Resource - terraform-provider-morpheus"
3+
subcategory: ""
4+
description: |-
5+
Provides a saml identity source resource
6+
---
7+
8+
# morpheus_saml_identity_source
9+
10+
Provides a saml identity source resource
11+
12+
## Example Usage
13+
14+
```terraform
15+
data "morpheus_tenant" "demo_tenant" {
16+
name = "Demo"
17+
}
18+
19+
resource "morpheus_saml_identity_source" "addemo" {
20+
tenant_id = morpheus_tenant.demo_tenant.id
21+
name = "samldemo"
22+
description = "TF example SAML identity source"
23+
login_redirect_url = "https://tfexamplesaml.test.local:8443/realms/master/protocol/saml"
24+
logout_redirect_url = "https://tfexamplesaml.test.local:8443/realms/master/protocol/saml"
25+
include_saml_request_parameter = true
26+
saml_request = "SelfSigned"
27+
validate_assertion_signature = false
28+
given_name_attribute = "givenName"
29+
surname_attribute = "surname"
30+
email_attribute = "email"
31+
default_account_role_id = 4
32+
role_attribute_name = "memberOf"
33+
required_role_attribute_value = "test"
34+
role_mapping {
35+
role_id = 4
36+
role_name = "Demo"
37+
assertion_attribute = "developers"
38+
}
39+
40+
role_mapping {
41+
role_id = 5
42+
role_name = "tf-example-user-role"
43+
assertion_attribute = "developers"
44+
}
45+
enable_role_mapping_permission = false
46+
}
47+
```
48+
49+
<!-- schema generated by tfplugindocs -->
50+
## Schema
51+
52+
### Required
53+
54+
- `default_account_role_id` (Number) The id of the default role a user is assigned when they are in the required group or if no specific group mapping applies to the user
55+
- `name` (String) The name of the SAML identity source
56+
- `tenant_id` (Number) The ID of the Morpheus tenant to associate the identity source with
57+
58+
### Optional
59+
60+
- `description` (String) The description of the SAML identity source
61+
- `email_attribute` (String) SAML SP field value to map to Morpheus user email address
62+
- `enable_role_mapping_permission` (Boolean) When enabled, Tenant users with appropriate rights to view and edit Roles will have the ability to set role mapping for the Identity Source integration
63+
- `given_name_attribute` (String) SAML SP field value to map to Morpheus user First Name
64+
- `include_saml_request_parameter` (Boolean) Whether to include the SAML request as a parameter
65+
- `login_redirect_url` (String) This is the SAML endpoint Morpheus will redirect to when a user signs into Morpheus via SAML
66+
- `logout_redirect_url` (String) The URL Morpheus will POST to when a SAML user logs out of Morpheus
67+
- `required_role_attribute_value` (String) The name of the attribute/assertion field that maps to the required role
68+
- `role_attribute_name` (String) The name of the attribute/assertion field that will map to Morpheus roles, such a MemberOf
69+
- `role_mapping` (Block Set) The SAML to Morpheus Role mapping (see [below for nested schema](#nestedblock--role_mapping))
70+
- `saml_request` (String) The SAML request configuration (NoSignature, SelfSigned, CustomSignature)
71+
- `surname_attribute` (String) SAML SP field value to map to Morpheus user Last Name
72+
- `validate_assertion_signature` (Boolean) Whether to validate the assertion signature (SAML RESPONSE field in the UI)
73+
74+
### Read-Only
75+
76+
- `id` (String) The ID of the SAML identity source
77+
78+
<a id="nestedblock--role_mapping"></a>
79+
### Nested Schema for `role_mapping`
80+
81+
Optional:
82+
83+
- `assertion_attribute` (String) The assertion attribute to map the role to
84+
- `role_id` (Number) The id of the Morpheus role to map to
85+
- `role_name` (String) The name or authority of the Morpheus role to map to
86+
87+
## Import
88+
89+
Import is supported using the following syntax:
90+
91+
```shell
92+
terraform import morpheus_saml_identity_source.tf_example_saml_identity_source 1
93+
```

docs/resources/workflow_catalog_item.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ resource "morpheus_workflow_catalog_item" "tfexample_workflow_catalog_item" {
4141

4242
- `content` (String) The markdown content associated with the workflow catalog item
4343
- `context_type` (String) The Morpheus context type of the operational workflow
44-
- `dark_logo_image_name` (String) The file name of the app blueprint catalog item dark mode logo image
45-
- `dark_logo_image_path` (String) The file path of the app blueprint catalog item dark mode logo image including the file name
44+
- `dark_logo_image_name` (String) The file name of the workflow catalog item dark mode logo image
45+
- `dark_logo_image_path` (String) The file path of the workflow catalog item dark mode logo image including the file name
4646
- `description` (String) The description of the workflow catalog item
4747
- `enabled` (Boolean) Whether the workflow catalog item is enabled
4848
- `featured` (Boolean) Whether the workflow catalog item is featured
4949
- `labels` (Set of String) The organization labels associated with the catalog item (Only supported on Morpheus 5.5.3 or higher)
50-
- `logo_image_name` (String) The file name of the app blueprint catalog item logo image
51-
- `logo_image_path` (String) The file path of the app blueprint catalog item logo image including the file name
50+
- `logo_image_name` (String) The file name of the workflow catalog item logo image
51+
- `logo_image_path` (String) The file path of the workflow catalog item logo image including the file name
5252
- `option_type_ids` (List of Number) The list of option type ids associated with the workflow catalog item
5353

5454
### Read-Only

examples/guides/getting_started/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
morpheus = {
44
source = "gomorpheus/morpheus"
5-
version = "0.9.3"
5+
version = "0.9.4"
66
}
77
}
88
}

examples/provider/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
morpheus = {
44
source = "gomorpheus/morpheus"
5-
version = "0.9.3"
5+
version = "0.9.4"
66
}
77
}
88
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import morpheus_saml_identity_source.tf_example_saml_identity_source 1
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
data "morpheus_tenant" "demo_tenant" {
2+
name = "Demo"
3+
}
4+
5+
resource "morpheus_saml_identity_source" "addemo" {
6+
tenant_id = morpheus_tenant.demo_tenant.id
7+
name = "samldemo"
8+
description = "TF example SAML identity source"
9+
login_redirect_url = "https://tfexamplesaml.test.local:8443/realms/master/protocol/saml"
10+
logout_redirect_url = "https://tfexamplesaml.test.local:8443/realms/master/protocol/saml"
11+
include_saml_request_parameter = true
12+
saml_request = "SelfSigned"
13+
validate_assertion_signature = false
14+
given_name_attribute = "givenName"
15+
surname_attribute = "surname"
16+
email_attribute = "email"
17+
default_account_role_id = 4
18+
role_attribute_name = "memberOf"
19+
required_role_attribute_value = "test"
20+
role_mapping {
21+
role_id = 4
22+
role_name = "Demo"
23+
assertion_attribute = "developers"
24+
}
25+
26+
role_mapping {
27+
role_id = 5
28+
role_name = "tf-example-user-role"
29+
assertion_attribute = "developers"
30+
}
31+
enable_role_mapping_permission = false
32+
}

morpheus/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ func Provider() *schema.Provider {
123123
"morpheus_restart_task": resourceRestartTask(),
124124
"morpheus_router_quota_policy": resourceRouterQuotaPolicy(),
125125
"morpheus_ruby_script_task": resourceRubyScriptTask(),
126+
"morpheus_saml_identity_source": resourceSAMLIdentitySource(),
126127
"morpheus_scale_threshold": resourceScaleThreshold(),
127128
"morpheus_script_template": resourceScriptTemplate(),
128129
"morpheus_security_package": resourceSecurityPackage(),

morpheus/resource_app_blueprint_catalog_item.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ func resourceAppBlueprintCatalogItemUpdate(ctx context.Context, d *schema.Resour
319319

320320
var filePayloads []*morpheus.FilePayload
321321

322-
if d.Get("logo_image_path") != "" && d.Get("logo_image_name") != "" {
322+
if d.HasChange("logo_image_path") || d.HasChange("logo_image_name") {
323323
data, err := os.ReadFile(d.Get("logo_image_path").(string))
324324
if err != nil {
325325
return diag.FromErr(err)
@@ -332,7 +332,7 @@ func resourceAppBlueprintCatalogItemUpdate(ctx context.Context, d *schema.Resour
332332
}
333333
filePayloads = append(filePayloads, filePayload)
334334
}
335-
if d.Get("dark_logo_image_path") != "" && d.Get("dark_logo_image_name") != "" {
335+
if d.HasChange("dark_logo_image_path") || d.HasChange("dark_logo_image_name") {
336336
darkLogoData, err := os.ReadFile(d.Get("dark_logo_image_path").(string))
337337
if err != nil {
338338
return diag.FromErr(err)

0 commit comments

Comments
 (0)