-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add saml application
- Loading branch information
Showing
24 changed files
with
723 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
page_title: "zitadel_application_saml Data Source - terraform-provider-zitadel" | ||
subcategory: "" | ||
description: |- | ||
Datasource representing a SAML application belonging to a project, with all configuration possibilities. | ||
--- | ||
|
||
# zitadel_application_saml (Data Source) | ||
|
||
Datasource representing a SAML application belonging to a project, with all configuration possibilities. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
data "zitadel_application_saml" "default" { | ||
org_id = data.zitadel_org.default.id | ||
project_id = data.zitadel_project.default.id | ||
app_id = "123456789012345678" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `app_id` (String) The ID of this resource. | ||
- `project_id` (String) ID of the project | ||
|
||
### Optional | ||
|
||
- `org_id` (String) ID of the organization | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
- `metadata_xml` (String) Metadata as XML file | ||
- `name` (String) Name of the application |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
page_title: "zitadel_application_samls Data Source - terraform-provider-zitadel" | ||
subcategory: "" | ||
description: |- | ||
Datasource representing multiple SAML applications belonging to a project. | ||
--- | ||
|
||
# zitadel_application_samls (Data Source) | ||
|
||
Datasource representing multiple SAML applications belonging to a project. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
data "zitadel_application_samls" "default" { | ||
org_id = data.zitadel_org.default.id | ||
project_id = data.zitadel_project.default.id | ||
name = "example-name" | ||
name_method = "TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE" | ||
} | ||
data "zitadel_application_saml" "default" { | ||
for_each = toset(data.zitadel_application_samls.default.app_ids) | ||
id = each.value | ||
} | ||
output "app_saml_names" { | ||
value = toset([ | ||
for app in data.zitadel_application_saml.default : app.name | ||
]) | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `name` (String) Name of the application | ||
- `project_id` (String) ID of the project | ||
|
||
### Optional | ||
|
||
- `name_method` (String) Method for querying applications by name, supported values: TEXT_QUERY_METHOD_EQUALS, TEXT_QUERY_METHOD_EQUALS_IGNORE_CASE, TEXT_QUERY_METHOD_STARTS_WITH, TEXT_QUERY_METHOD_STARTS_WITH_IGNORE_CASE, TEXT_QUERY_METHOD_CONTAINS, TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE, TEXT_QUERY_METHOD_ENDS_WITH, TEXT_QUERY_METHOD_ENDS_WITH_IGNORE_CASE | ||
- `org_id` (String) ID of the organization | ||
|
||
### Read-Only | ||
|
||
- `app_ids` (List of String) A set of all IDs. | ||
- `id` (String) The ID of this resource. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
page_title: "zitadel_application_saml Resource - terraform-provider-zitadel" | ||
subcategory: "" | ||
description: |- | ||
Resource representing a SAML application belonging to a project, with all configuration possibilities. | ||
--- | ||
|
||
# zitadel_application_saml (Resource) | ||
|
||
Resource representing a SAML application belonging to a project, with all configuration possibilities. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "zitadel_application_saml" "default" { | ||
org_id = data.zitadel_org.default.id | ||
project_id = data.zitadel_project.default.id | ||
name = "applicationapi" | ||
metadata_xml = "<?xml version=\"1.0\"?>\n<md:EntityDescriptor xmlns:md=\"urn:oasis:names:tc:SAML:2.0:metadata\"\n validUntil=\"2024-01-26T17:48:38Z\"\n cacheDuration=\"PT604800S\"\n entityID=\"http://example.com/saml/metadata\">\n <md:SPSSODescriptor AuthnRequestsSigned=\"false\" WantAssertionsSigned=\"false\" protocolSupportEnumeration=\"urn:oasis:names:tc:SAML:2.0:protocol\">\n <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat>\n <md:AssertionConsumerService Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\"\n Location=\"http://example.com/saml/cas\"\n index=\"1\" />\n \n </md:SPSSODescriptor>\n</md:EntityDescriptor>" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `metadata_xml` (String, Sensitive) Metadata as XML file | ||
- `name` (String) Name of the application | ||
- `project_id` (String) ID of the project | ||
|
||
### Optional | ||
|
||
- `org_id` (String) ID of the organization | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
|
||
## Import | ||
|
||
```terraform | ||
# The resource can be imported using the ID format `<id:project_id[:org_id]>`, e.g. | ||
terraform import application_saml.imported '123456789012345678:123456789012345678:123456789012345678' | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
data "zitadel_application_saml" "default" { | ||
org_id = data.zitadel_org.default.id | ||
project_id = data.zitadel_project.default.id | ||
app_id = "123456789012345678" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
data "zitadel_application_samls" "default" { | ||
org_id = data.zitadel_org.default.id | ||
project_id = data.zitadel_project.default.id | ||
name = "example-name" | ||
name_method = "TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE" | ||
} | ||
|
||
data "zitadel_application_saml" "default" { | ||
for_each = toset(data.zitadel_application_samls.default.app_ids) | ||
id = each.value | ||
} | ||
|
||
output "app_saml_names" { | ||
value = toset([ | ||
for app in data.zitadel_application_saml.default : app.name | ||
]) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# The resource can be imported using the ID format `<id:project_id[:org_id]>`, e.g. | ||
terraform import application_saml.imported '123456789012345678:123456789012345678:123456789012345678' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
resource "zitadel_application_saml" "default" { | ||
org_id = data.zitadel_org.default.id | ||
project_id = data.zitadel_project.default.id | ||
name = "applicationapi" | ||
metadata_xml = "<?xml version=\"1.0\"?>\n<md:EntityDescriptor xmlns:md=\"urn:oasis:names:tc:SAML:2.0:metadata\"\n validUntil=\"2024-01-26T17:48:38Z\"\n cacheDuration=\"PT604800S\"\n entityID=\"http://example.com/saml/metadata\">\n <md:SPSSODescriptor AuthnRequestsSigned=\"false\" WantAssertionsSigned=\"false\" protocolSupportEnumeration=\"urn:oasis:names:tc:SAML:2.0:protocol\">\n <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat>\n <md:AssertionConsumerService Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\"\n Location=\"http://example.com/saml/cas\"\n index=\"1\" />\n \n </md:SPSSODescriptor>\n</md:EntityDescriptor>" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" | ||
subcategory: "" | ||
description: |- | ||
{{ .Description | plainmarkdown | trimspace | prefixlines " " }} | ||
--- | ||
|
||
# {{.Name}} ({{.Type}}) | ||
|
||
{{ .Description | trimspace }} | ||
|
||
## Example Usage | ||
|
||
{{ tffile "examples/provider/data-sources/application_saml.tf" }} | ||
|
||
{{ .SchemaMarkdown | trimspace }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" | ||
subcategory: "" | ||
description: |- | ||
{{ .Description | plainmarkdown | trimspace | prefixlines " " }} | ||
--- | ||
|
||
# {{.Name}} ({{.Type}}) | ||
|
||
{{ .Description | trimspace }} | ||
|
||
## Example Usage | ||
|
||
{{ tffile "examples/provider/data-sources/application_samls.tf" }} | ||
|
||
{{ .SchemaMarkdown | trimspace }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" | ||
subcategory: "" | ||
description: |- | ||
{{ .Description | plainmarkdown | trimspace | prefixlines " " }} | ||
--- | ||
|
||
# {{.Name}} ({{.Type}}) | ||
|
||
{{ .Description | trimspace }} | ||
|
||
## Example Usage | ||
|
||
{{ tffile "examples/provider/resources/application_saml.tf" }} | ||
|
||
{{ .SchemaMarkdown | trimspace }} | ||
|
||
## Import | ||
|
||
{{ tffile "examples/provider/resources/application_saml-import.sh" }} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
25 changes: 25 additions & 0 deletions
25
zitadel/application_saml/application_saml_test_dep/dependency.go
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package application_saml_test_dep | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/zitadel/zitadel-go/v2/pkg/client/zitadel/management" | ||
|
||
"github.com/zitadel/terraform-provider-zitadel/zitadel/application_saml" | ||
"github.com/zitadel/terraform-provider-zitadel/zitadel/helper/test_utils" | ||
) | ||
|
||
func Create(t *testing.T, frame *test_utils.OrgTestFrame, projectID, name string) (string, string) { | ||
return test_utils.CreateDefaultDependency(t, "zitadel_application_saml", application_saml.AppIDVar, func() (string, error) { | ||
app, err := frame.AddSAMLApp(frame, &management.AddSAMLAppRequest{ | ||
ProjectId: projectID, | ||
Name: name, | ||
Metadata: &management.AddSAMLAppRequest_MetadataXml{MetadataXml: metadata(name)}, | ||
}) | ||
return app.GetAppId(), err | ||
}) | ||
} | ||
|
||
func metadata(name string) []byte { | ||
return []byte("<?xml version=\"1.0\"?>\n<md:EntityDescriptor xmlns:md=\"urn:oasis:names:tc:SAML:2.0:metadata\"\n validUntil=\"2024-01-26T17:48:38Z\"\n cacheDuration=\"PT604800S\"\n entityID=\"" + name + "\">\n <md:SPSSODescriptor AuthnRequestsSigned=\"false\" WantAssertionsSigned=\"false\" protocolSupportEnumeration=\"urn:oasis:names:tc:SAML:2.0:protocol\">\n <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat>\n <md:AssertionConsumerService Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\"\n Location=\"http://example.com/saml/cas\"\n index=\"1\" />\n \n </md:SPSSODescriptor>\n</md:EntityDescriptor>") | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package application_saml | ||
|
||
const ( | ||
AppIDVar = "app_id" | ||
appIDsVar = "app_ids" | ||
ProjectIDVar = "project_id" | ||
NameVar = "name" | ||
nameMethodVar = "name_method" | ||
MetadataXMLVar = "metadata_xml" | ||
) |
Oops, something went wrong.