Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Hosted Page Resource + Advanced App Fields in Cidaas App Resource

See merge request cidaas-management/terraform!33
  • Loading branch information
Tujit Bora committed Nov 13, 2023
2 parents 4dd8775 + 7e19a47 commit 74f1c3e
Show file tree
Hide file tree
Showing 10 changed files with 2,678 additions and 184 deletions.
273 changes: 239 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ resource "cidaas_custom_provider" "cp" {
],
}
}
```

Use the command below to import an existing cidaas_custom_provider

```ssh
terraform import cidaas_custom_provider.<resource name> provider_name
```

##### Cidaas App Resource
Expand All @@ -132,33 +137,202 @@ Please add the below scopes to the client with client_id set in the env in order

```hcl
resource "cidaas_app" "terraform_app" {
client_type = "SINGLE_PAGE"
allow_login_with = ["EMAIL", "MOBILE", "USER_NAME"]
auto_login_after_register = true
enable_passwordless_auth = false
register_with_login_information = true
hosted_page_group = "default"
client_name = "Terraform Test"
client_display_name = "Terraform Test"
company_name = "Widas ID GmbH"
company_address = "01"
company_website = "https://cidaas.com"
allowed_scopes = ["openid", "cidaas:register", "profile"]
response_types = ["code", "token", "id_token"]
grant_types = ["client_credentials"]
template_group_id = "custtemp"
redirect_uris = ["https://cidaas.com"]
allowed_logout_urls = ["https://cidaas.com"]
fds_enabled = false
login_providers = ["login_provider1", "login_provider2"]
client_type = "SINGLE_PAGE"
accent_color = "#ef4923"
primary_color = "#ef4923"
media_type = "IMAGE"
content_align = "CENTER"
allow_login_with = ["EMAIL", "MOBILE", "USER_NAME"]
redirect_uris = ["https://cidaas.com"]
allowed_logout_urls = ["https://cidaas.com"]
enable_deduplication = true
auto_login_after_register = true
enable_passwordless_auth = false
register_with_login_information = true
allow_disposable_email = false
validate_phone_number = false
fds_enabled = false
hosted_page_group = "default"
client_name = "Terraform Test App"
client_display_name = "Test Test App Display Name"
company_name = "Widas ID GmbH"
company_address = "01"
company_website = "https://cidaas.com"
allowed_scopes = ["openid", "cidaas:register", "profile"]
response_types = ["code", "token", "id_token"]
grant_types = ["client_credentials"]
login_providers = ["login_provider1", "login_provider2"]
additional_access_token_payload = ["sample_payload"]
required_fields = ["email"]
is_hybrid_app = false
allowed_web_origins = ["https://cidaas.com"]
allowed_origins = ["https://cidaas.com"]
mobile_settings {
team_id = "sample-team-id"
bundle_id = "sample-bundle-id"
package_name = "sample-package-name"
key_hash = "sample-key-hash"
}
default_max_age = 86400
id_token_lifetime_in_seconds = 86400
token_lifetime_in_seconds = 86400
id_token_lifetime_in_seconds = 86400
refresh_token_lifetime_in_seconds = 15780000
custom_provider_name = cidaas_custom_provider.cp.provider_name
template_group_id = "custtemp"
custom_provider_name = "test-custom-provider"
policy_uri = "https://cidaas.com"
tos_uri = "https://cidaas.com"
imprint_uri = "https://cidaas.com"
contacts = ["[email protected]"]
token_endpoint_auth_method = "client_secret_post"
token_endpoint_auth_signing_alg = "RS256"
default_acr_values = ["default"]
editable = true
web_message_uris = ["https://cidaas.com"]
social_providers {
provider_name = "cidaas social provider"
social_id = "fdc63bd0-6044-4fa0-abff"
display_name = "cidaas"
}
custom_providers {
logo_url = "https://cidaas.com/logo-url"
provider_name = "sample-custom-provider"
display_name = "sample-custom-provider"
type = "CUSTOM_OPENID_CONNECT"
}
saml_providers {
logo_url = "https://cidaas.com/logo-url"
provider_name = "sample-sampl-provider"
display_name = "sample-sampl-provider"
type = "SAMPL_IDP_PROVIDER"
}
ad_providers {
logo_url = "https://cidaas.com/logo-url"
provider_name = "sample-ad-provider"
display_name = "sample-ad-provider"
type = "ADD_PROVIDER"
}
app_owner = "Cidaas"
jwe_enabled = false
user_consent = false
allowed_groups {
group_id = "developer101"
roles = ["developer", "qa", "admin"]
default_roles = ["developer"]
}
operations_allowed_groups {
group_id = "developer101"
roles = ["developer", "qa", "admin"]
default_roles = ["developer"]
}
deleted = false
enabled = false
allowed_fields = ["email"]
always_ask_mfa = false
smart_mfa = false
allowed_mfa = ["OFF"]
captcha_ref = "sample-captcha-ref"
captcha_refs = ["sample"]
consent_refs = ["sample"]
communication_medium_verification = "email_verification_required_on_usage"
email_verification_required = true
mobile_number_verification_required = true
allowed_roles = ["sample"]
default_roles = ["sample"]
enable_classical_provider = false
is_remember_me_selected = false
bot_provider = "CIDAAS"
allow_guest_login_groups {
group_id = "developer101"
roles = ["developer", "qa", "admin"]
default_roles = ["developer"]
}
is_login_success_page_enabled = false
is_register_success_page_enabled = false
group_ids = ["sample"]
admin_client = false
is_group_login_selection_enabled = false
group_selection {
selectable_groups = ["developer-users"]
selectable_group_types = ["sample"]
}
group_types = ["sample"]
backchannel_logout_uri = "https://test.com/logout"
post_logout_redirect_uris = ["sample"]
logo_align = "CENTER"
mfa {
setting = "OFF"
time_interval_in_seconds = 86400
allowed_methods = [""]
}
push_config {
tenant_key = "cidaas-tenant"
name = "sample-push-config"
vendor = "cidaas"
key = "bcb-4a6b-9777-8a64abe6af"
secret = "bcb-4a6b-9777-8a64abe6af"
owner = "cidaas"
}
webfinger = "no_redirection"
application_type = ""
logo_uri = "https://sample-logo.com/logo"
initiate_login_uri = "https://cidaas.com/initiate-login"
client_secret_expires_at = 3600
client_id_issued_at = 3600
registration_client_uri = "https://cidaas.com/registration-client-uri"
registration_access_token = "registration access token"
client_uri = "https://cidaas.com/client-uri"
jwks_uri = "https://cidaas.com/jwk-uri"
jwks = "https://cidaas.com/jwks"
sector_identifier_uri = "https://cidaas.com/sector-identifier-uri"
subject_type = "sample subject type"
id_token_signed_response_alg = "RS256"
id_token_encrypted_response_alg = "RS256"
id_token_encrypted_response_enc = ""
userinfo_signed_response_alg = "RS256"
userinfo_encrypted_response_alg = "RS256"
userinfo_encrypted_response_enc = ""
request_object_signing_alg = "RS256"
request_object_encryption_alg = "RS256"
request_object_encryption_enc = "userinfo_encrypted_response_enc"
request_uris = ["sample"]
basic_settings {
client_id = "test-client-id"
token_endpoint_auth_method = "client_secret_post"
redirect_uris = ["https://cidaas.com/redirect1", "https://cidaas.com/redirect2"]
allowed_logout_urls = ["https://cidaas.com/logout-url", "https://cidaas.com/logout-url"]
app_owner = "cidaas"
allowed_scopes = ["profile", "email"]
hosted_page_group = "sample-hosted-page-group"
}
description = "it's a sample description of the client. The client supports system to system communication"
default_scopes = ["sample"]
pending_scopes = ["sample"]
consent_page_group = "sample-consent-page-group"
password_policy_ref = "password-policy-ref"
blocking_mechanism_ref = "blocking-mechanism-ref"
sub = "sample-sub"
role = "sample-role"
mfa_configuration = "sample-configuration"
suggest_mfa = ["OFF"]
login_spi {
oauth_client_id = "bcb-4a6b-9777-8a64abe6af"
spi_url = "https://cidaas.com/spi-url"
}
video_url = "https://cidaas.com/video-url"
bot_captcha_ref = "sample-bot-captcha-ref"
background_uri = "http://cidaas.com/background-uri"
}
```

Use the command below to import an existing cidaas_app

```ssh
terraform import cidaas_app.<resource name> client_id
```


##### Cidaas Scope Resource

An example of Scope resource configuration. Please add the below scopes to the client with client_id set in the env in order to perform CRUD on cidaas_scope
Expand All @@ -180,6 +354,13 @@ resource "cidaas_scope" "sample" {
}
```

Use the command below to import an existing cidaas_scope

```ssh
terraform import cidaas_scope.<resource name> scope_key
```


##### Cidaas Registration Page Field Resource

An example of Registration Page Field resource configuration. Please add the below scopes to the client with client_id set in the env in order to perform CRUD on cidaas_registration_page_field
Expand Down Expand Up @@ -208,6 +389,14 @@ resource "cidaas_registration_page_field" "Enter resource name for resource type
}
```

Use the command below to import an existing cidaas_registration_page_field

```ssh
terraform import cidaas_registration_page_field.<resource name> field_key
```



##### Cidaas Webhook Resource

Some examples of Webhook resource configuration shown below. Please add the below scopes to the client with client_id set in the env in order to perform CRUD on cidaas_webhook
Expand Down Expand Up @@ -273,31 +462,47 @@ resource "cidaas_webhook" "sample_webhook" {
}
```

## Import Cidaas Resources
Use the command below to import an existing cidaas_webhook

```ssh
terraform import cidaas_webhook.<resource name> webhook_id
```

you can import cidaas resource by running the below command. Before you can import you need to an empty terraform resource to import one. Example:
##### Cidaas Hosted Page Resource

Please add the below scopes to the client with client_id set in the env in order to perform CRUD on cidaas_hosted_page

* cidaas:hosted_pages_write
* cidaas:hosted_pages_read
* cidaas:hosted_pages_delete

```hcl
resrouce "cidaas_custom_provider" "sample" {}
resource "cidaas_hosted_page" "sample" {
hosted_page_group_name = "hosted-page-sample-group"
default_locale = "en-us"
hosted_pages {
hosted_page_id = "register_success"
locale = "en-us"
url = "https://terraform-cidaas-test-free.cidaas.de/register_success_hosted_page"
}
output "sample_custom_provider" {
value = cidaas_custom_provider.sample
hosted_pages {
hosted_page_id = "login_success"
locale = "en-us"
url = "https://terraform-cidaas-test-free.cidaas.de/login_success_hosted_page"
}
}
```

### Import an existing cidaas app
```ssh
terraform import cidaas_app.<resource name> client_id
```

### Import an existing cidaas custom provider
Use the command below to import an existing cidaas_hosted_page

```ssh
terraform import cidaas_custom_provider.<resource name> provider_name
terraform import cidaas_hosted_page.<resource name> hosted_page_group_name
```

- Run Terraform commands going inside Example directory where Terraform config file main.tf is located
##### To start using the provider run the Terraform commands below going inside the example directory where Terraform config files are available

1. terraform init : It will build the Terraform Cidaas Plugin/Provider.
2. terraform Plan : It will show the plan that Terraform has to execute from the current config file(main.tf) configurations.
Expand Down
1 change: 1 addition & 0 deletions cidaas/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func Provider() *schema.Provider {
"cidaas_custom_provider": resourceCustomProvider(),
"cidaas_scope": resourceScope(),
"cidaas_webhook": resourceWebhook(),
"cidaas_hosted_page": resourceHostedPage(),
},
ConfigureContextFunc: providerConfigure,
}
Expand Down
Loading

0 comments on commit 74f1c3e

Please sign in to comment.