Skip to content

Commit

Permalink
Added authorization group example
Browse files Browse the repository at this point in the history
  • Loading branch information
bczoma committed Mar 12, 2024
1 parent 0afbcfb commit bcd00b2
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 20 deletions.
8 changes: 6 additions & 2 deletions examples/acl-profile-exceptions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,25 @@ Also note that topic exceptions may use [substitution variables](https://docs.so

### Optional Inputs

* `acl_profile_publish_topic_exceptions`, `acl_profile_subscribe_share_name_exceptions`, `acl_profile_subscribe_topic_exceptions`, `acl_profile_client_connect_exceptions` - examples show how to define them in a list form.
* `acl_profile_publish_topic_exceptions`, `acl_profile_subscribe_topic_exceptions`, `acl_profile_subscribe_share_name_exceptions`, `acl_profile_client_connect_exceptions` - examples show how to define them in a list form.

Optional module input variables have the same name as the attributes of the underlying provider resource. If omitted then the default for the related resource attribute will be configured on the broker. For attributes and defaults, refer to the [documentation of "solacebroker_msg_vpn_client_username"](https://registry.terraform.io/providers/SolaceProducts/solacebroker/latest/docs/resources/msg_vpn_client_username#optional).

The module default for the `enabled` variable is true, which enables both the RDP and the REST consumer resources.

### Output

The module `client_username` output refers to the created client username.
The module `client_username` output refers to the created client username and the exceptions outputs provide the list the created exceptions.

## Created resources

This example will create following resources:

* `solacebroker_msg_vpn_client_username`
* `solacebroker_msg_vpn_acl_profile_publish_topic_exception`
* `solacebroker_msg_vpn_acl_profile_subscribe_topic_exception`
* `solacebroker_msg_vpn_acl_profile_subscribe_share_name_exception`
* `solacebroker_msg_vpn_acl_profile_client_connect_exception`

## Running the Example

Expand Down
66 changes: 66 additions & 0 deletions examples/authorization-group/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Authorization Group Configuration Example

Configuration in this directory creates an authorization group on the PubSub+ event broker, leveraging the Client Terraform module. The authorization group can be used for [OAuth](https://docs.solace.com/Security/Client-Authorization-Overview.htm#Authoriz2) or [LDAP](https://docs.solace.com/Security/Client-Authorization-Overview.htm#LDAP-Groups) authorization.

## Module Configuration in the Example

### Required Inputs

* `msg_vpn_name` - set to `default` in the example
* `client_identifier_type` - set to `authorization_group`
* `client_identifier_name` - set to `myauthgroup` in the example.
* `client_profile_name` - `default`, in the example
* `acl_profile_name` - `default`, in the example

### Optional Inputs

Optional module input variables have the same name as the attributes of the underlying provider resource. If omitted then the default for the related resource attribute will be configured on the broker. For attributes and defaults, refer to the [documentation of "solacebroker_msg_vpn_authorization_group"](https://registry.terraform.io/providers/SolaceProducts/solacebroker/latest/docs/resources/msg_vpn_authorization_group#optional).

The module default for the `enabled` variable is true, which enables both the RDP and the REST consumer resources.

### Output

The module `authorization_group` output refers to the created authorization group.

## Created resources

This example will create following resources:

* `solacebroker_msg_vpn_authorization_group`

## Running the Example

### Access to a PubSub+ broker

If you don't already have access to a broker, refer to the [Developers page](https://www.solace.dev/) for options to get started.

### Sample source code

The sample is available from the module GitHub repo:

```bash
git clone https://github.com/SolaceProducts/terraform-solacebroker-rest-delivery.git
cd examples/adding-headers
```

### Adjust Provider Configuration

Adjust the [provider parameters](https://registry.terraform.io/providers/SolaceProducts/solacebroker/latest/docs#schema) in `main.tf` according to your broker. The example configuration shows settings for a local broker running in Docker.

### Create the resource

Hint: You can verify configuration changes on the broker, before and after, using the [PubSub+ Broker Manager Web UI](https://docs.solace.com/Admin/Broker-Manager/PubSub-Manager-Overview.htm)

Execute from this folder:

```bash
terraform init
terraform plan
terraform apply
```

Run `terraform destroy` to clean up created resources when no longer needed.

## Additional Documentation

Refer to the [Configuring Client Authorization](https://docs.solace.com/Security/Configuring-Client-Authorization.htm) section in the PubSub+ documentation.
18 changes: 9 additions & 9 deletions internal/gen-template/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ resource "solacebroker_msg_vpn_acl_profile_publish_topic_exception" "main" {
publish_topic_exception_syntax = local.acl_profile_publish_topic_exceptions_list[count.index].publish_topic_exception_syntax
}

resource "solacebroker_msg_vpn_acl_profile_subscribe_share_name_exception" "main" {
count = length(local.acl_profile_subscribe_share_name_exceptions_list)

msg_vpn_name = var.msg_vpn_name
acl_profile_name = var.acl_profile_name
subscribe_share_name_exception = local.acl_profile_subscribe_share_name_exceptions_list[count.index].subscribe_share_name_exception
subscribe_share_name_exception_syntax = local.acl_profile_subscribe_share_name_exceptions_list[count.index].subscribe_share_name_exception_syntax
}

resource "solacebroker_msg_vpn_acl_profile_subscribe_topic_exception" "main" {
count = length(local.acl_profile_subscribe_topic_exceptions_list)

Expand All @@ -56,6 +47,15 @@ resource "solacebroker_msg_vpn_acl_profile_subscribe_topic_exception" "main" {
subscribe_topic_exception_syntax = local.acl_profile_subscribe_topic_exceptions_list[count.index].subscribe_topic_exception_syntax
}

resource "solacebroker_msg_vpn_acl_profile_subscribe_share_name_exception" "main" {
count = length(local.acl_profile_subscribe_share_name_exceptions_list)

msg_vpn_name = var.msg_vpn_name
acl_profile_name = var.acl_profile_name
subscribe_share_name_exception = local.acl_profile_subscribe_share_name_exceptions_list[count.index].subscribe_share_name_exception
subscribe_share_name_exception_syntax = local.acl_profile_subscribe_share_name_exceptions_list[count.index].subscribe_share_name_exception_syntax
}

resource "solacebroker_msg_vpn_acl_profile_client_connect_exception" "main" {
count = length(var.acl_profile_client_connect_exceptions)

Expand Down
18 changes: 9 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,6 @@ resource "solacebroker_msg_vpn_acl_profile_publish_topic_exception" "main" {
publish_topic_exception_syntax = local.acl_profile_publish_topic_exceptions_list[count.index].publish_topic_exception_syntax
}

resource "solacebroker_msg_vpn_acl_profile_subscribe_share_name_exception" "main" {
count = length(local.acl_profile_subscribe_share_name_exceptions_list)

msg_vpn_name = var.msg_vpn_name
acl_profile_name = var.acl_profile_name
subscribe_share_name_exception = local.acl_profile_subscribe_share_name_exceptions_list[count.index].subscribe_share_name_exception
subscribe_share_name_exception_syntax = local.acl_profile_subscribe_share_name_exceptions_list[count.index].subscribe_share_name_exception_syntax
}

resource "solacebroker_msg_vpn_acl_profile_subscribe_topic_exception" "main" {
count = length(local.acl_profile_subscribe_topic_exceptions_list)

Expand All @@ -73,6 +64,15 @@ resource "solacebroker_msg_vpn_acl_profile_subscribe_topic_exception" "main" {
subscribe_topic_exception_syntax = local.acl_profile_subscribe_topic_exceptions_list[count.index].subscribe_topic_exception_syntax
}

resource "solacebroker_msg_vpn_acl_profile_subscribe_share_name_exception" "main" {
count = length(local.acl_profile_subscribe_share_name_exceptions_list)

msg_vpn_name = var.msg_vpn_name
acl_profile_name = var.acl_profile_name
subscribe_share_name_exception = local.acl_profile_subscribe_share_name_exceptions_list[count.index].subscribe_share_name_exception
subscribe_share_name_exception_syntax = local.acl_profile_subscribe_share_name_exceptions_list[count.index].subscribe_share_name_exception_syntax
}

resource "solacebroker_msg_vpn_acl_profile_client_connect_exception" "main" {
count = length(var.acl_profile_client_connect_exceptions)

Expand Down

0 comments on commit bcd00b2

Please sign in to comment.