Skip to content

Commit

Permalink
feat(MQ on Cloud): Add ams channels config support to keystore resour…
Browse files Browse the repository at this point in the history
…ce (#5411)

* feat(MQ on Cloud): add ams channels config support to keystore resource

pat: update docs and base configurations

pat: utils change

* fix(MQ on Cloud): make ams config optional in keystore resource
  • Loading branch information
shuaibbapputty authored Jun 12, 2024
1 parent 9359e9e commit 6dd26fd
Show file tree
Hide file tree
Showing 45 changed files with 1,956 additions and 478 deletions.
35 changes: 34 additions & 1 deletion examples/ibm-mqcloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The following resources are supported:
* ibm_mqcloud_truststore_certificate

The following data sources are supported:
* ibm_mqcloud_queue_manager_options
* ibm_mqcloud_queue_manager
* ibm_mqcloud_queue_manager_status
* ibm_mqcloud_application
Expand Down Expand Up @@ -53,7 +54,7 @@ resource "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" {
| name | A queue manager name conforming to MQ restrictions. | `string` | true |
| display_name | A displayable name for the queue manager - limited only in length. | `string` | false |
| location | The locations in which the queue manager could be deployed. | `string` | true |
| size | The queue manager sizes of deployment available. Deployment of lite queue managers for aws_us_east_1 and aws_eu_west_1 locations is not available. | `string` | true |
| size | The queue manager sizes of deployment available. | `string` | true |
| version | The MQ version of the queue manager. | `string` | false |

#### Outputs
Expand Down Expand Up @@ -130,6 +131,14 @@ resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instan
queue_manager_id = var.mqcloud_keystore_certificate_queue_manager_id
label = var.mqcloud_keystore_certificate_label
certificate_file = var.mqcloud_keystore_certificate_certificate_file
config {
ams {
channels {
name = var.mqcloud_keystore_certificate_config_ams_channel_name
}
}
}
}
```

Expand Down Expand Up @@ -159,6 +168,7 @@ resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instan
| dns_names_total_count | The total count of dns names. |
| dns_names | The list of DNS names. |
| href | The URL for this key store certificate. |
| config | The configuration details for this certificate. |
| certificate_id | ID of the certificate. |

### Resource: ibm_mqcloud_truststore_certificate
Expand Down Expand Up @@ -200,6 +210,29 @@ resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_in

## MQ on Cloud data sources

### Data source: ibm_mqcloud_queue_manager_options

```hcl
data "ibm_mqcloud_queue_manager_options" "mqcloud_queue_manager_options_instance" {
service_instance_guid = var.mqcloud_queue_manager_options_service_instance_guid
}
```

#### Inputs

| Name | Description | Type | Required |
|------|-------------|------|---------|
| service_instance_guid | The GUID that uniquely identifies the MQ on Cloud service instance. | `string` | true |

#### Outputs

| Name | Description |
|------|-------------|
| locations | List of deployment locations. |
| sizes | List of queue manager sizes. |
| versions | List of queue manager versions. |
| latest_version | The latest Queue manager version. |

### Data source: ibm_mqcloud_queue_manager

```hcl
Expand Down
45 changes: 31 additions & 14 deletions examples/ibm-mqcloud/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,59 @@ provider "ibm" {
// Provision mqcloud_queue_manager resource instance
resource "ibm_mqcloud_queue_manager" "mqcloud_queue_manager_instance" {
service_instance_guid = var.mqcloud_queue_manager_service_instance_guid
name = var.mqcloud_queue_manager_name
display_name = var.mqcloud_queue_manager_display_name
location = var.mqcloud_queue_manager_location
size = var.mqcloud_queue_manager_size
version = var.mqcloud_queue_manager_version
name = var.mqcloud_queue_manager_name
display_name = var.mqcloud_queue_manager_display_name
location = var.mqcloud_queue_manager_location
size = var.mqcloud_queue_manager_size
version = var.mqcloud_queue_manager_version
}

// Provision mqcloud_application resource instance
resource "ibm_mqcloud_application" "mqcloud_application_instance" {
service_instance_guid = var.mqcloud_application_service_instance_guid
name = var.mqcloud_application_name
name = var.mqcloud_application_name
}

// Provision mqcloud_user resource instance
resource "ibm_mqcloud_user" "mqcloud_user_instance" {
service_instance_guid = var.mqcloud_user_service_instance_guid
name = var.mqcloud_user_name
email = var.mqcloud_user_email
name = var.mqcloud_user_name
email = var.mqcloud_user_email
}

// Provision mqcloud_keystore_certificate resource instance
resource "ibm_mqcloud_keystore_certificate" "mqcloud_keystore_certificate_instance" {
service_instance_guid = var.mqcloud_keystore_certificate_service_instance_guid
queue_manager_id = var.mqcloud_keystore_certificate_queue_manager_id
label = var.mqcloud_keystore_certificate_label
certificate_file = var.mqcloud_keystore_certificate_certificate_file
queue_manager_id = var.mqcloud_keystore_certificate_queue_manager_id
label = var.mqcloud_keystore_certificate_label
certificate_file = var.mqcloud_keystore_certificate_certificate_file

config {
ams {
channels {
name = var.mqcloud_keystore_certificate_config_ams_channel_name
}
}
}
}

// Provision mqcloud_truststore_certificate resource instance
resource "ibm_mqcloud_truststore_certificate" "mqcloud_truststore_certificate_instance" {
service_instance_guid = var.mqcloud_truststore_certificate_service_instance_guid
queue_manager_id = var.mqcloud_truststore_certificate_queue_manager_id
label = var.mqcloud_truststore_certificate_label
certificate_file = var.mqcloud_truststore_certificate_certificate_file
queue_manager_id = var.mqcloud_truststore_certificate_queue_manager_id
label = var.mqcloud_truststore_certificate_label
certificate_file = var.mqcloud_truststore_certificate_certificate_file
}

// Data source is not linked to a resource instance
// Uncomment if an existing data source instance exists
/*
// Create mqcloud_queue_manager_options data source
data "ibm_mqcloud_queue_manager_options" "mqcloud_queue_manager_options_instance" {
service_instance_guid = var.mqcloud_queue_manager_options_service_instance_guid
}
*/

// Data source is not linked to a resource instance
// Uncomment if an existing data source instance exists
/*
Expand Down
24 changes: 18 additions & 6 deletions examples/ibm-mqcloud/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ variable "mqcloud_queue_manager_location" {
default = "reserved-eu-de-cluster-f884"
}
variable "mqcloud_queue_manager_size" {
description = "The queue manager sizes of deployment available. Deployment of lite queue managers for aws_us_east_1 and aws_eu_west_1 locations is not available."
description = "The queue manager sizes of deployment available."
type = string
default = "lite"
default = "xsmall"
}
variable "mqcloud_queue_manager_version" {
description = "The MQ version of the queue manager."
Expand Down Expand Up @@ -56,12 +56,12 @@ variable "mqcloud_user_service_instance_guid" {
variable "mqcloud_user_name" {
description = "The shortname of the user that will be used as the IBM MQ administrator in interactions with a queue manager for this service instance."
type = string
default = "t0scie98o57a"
default = "testuser"
}
variable "mqcloud_user_email" {
description = "The email of the user."
type = string
default = "user@example.com"
default = "testuser@ibm.com"
}

// Resource arguments for mqcloud_keystore_certificate
Expand All @@ -78,13 +78,18 @@ variable "mqcloud_keystore_certificate_queue_manager_id" {
variable "mqcloud_keystore_certificate_label" {
description = "The label to use for the certificate to be uploaded."
type = string
default = "label"
default = "certlabel"
}
variable "mqcloud_keystore_certificate_certificate_file" {
description = "The filename and path of the certificate to be uploaded."
type = string
default = "SGVsbG8gd29ybGQ="
}
variable "mqcloud_keystore_certificate_config_ams_channel_name" {
description = "A channel's information that is configured with this certificate."
type = string
default = "CLOUD.APP.SVRCONN"
}

// Resource arguments for mqcloud_truststore_certificate
variable "mqcloud_truststore_certificate_service_instance_guid" {
Expand All @@ -100,14 +105,21 @@ variable "mqcloud_truststore_certificate_queue_manager_id" {
variable "mqcloud_truststore_certificate_label" {
description = "The label to use for the certificate to be uploaded."
type = string
default = "label"
default = "certlabel"
}
variable "mqcloud_truststore_certificate_certificate_file" {
description = "The filename and path of the certificate to be uploaded."
type = string
default = "SGVsbG8gd29ybGQ="
}

// Data source arguments for mqcloud_queue_manager_options
variable "mqcloud_queue_manager_options_service_instance_guid" {
description = "The GUID that uniquely identifies the MQ on Cloud service instance."
type = string
default = "Service Instance ID"
}

// Data source arguments for mqcloud_queue_manager
variable "data_mqcloud_queue_manager_service_instance_guid" {
description = "The GUID that uniquely identifies the MQ on Cloud service instance."
Expand Down
14 changes: 2 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/IBM/event-notifications-go-admin-sdk v0.6.1
github.com/IBM/eventstreams-go-sdk v1.4.0
github.com/IBM/go-sdk-core/v3 v3.2.4
github.com/IBM/go-sdk-core/v5 v5.17.0
github.com/IBM/go-sdk-core/v5 v5.17.2
github.com/IBM/ibm-cos-sdk-go v1.10.1
github.com/IBM/ibm-cos-sdk-go-config/v2 v2.0.4
github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20211109141421-a4b61b05f7d1
Expand Down Expand Up @@ -66,7 +66,7 @@ require (
github.com/IBM-Cloud/bluemix-go v0.0.0-20240423071914-9e96525baef4
github.com/IBM/go-sdk-core v1.1.0
github.com/IBM/logs-go-sdk v0.1.1
github.com/IBM/mqcloud-go-sdk v0.0.4
github.com/IBM/mqcloud-go-sdk v0.1.0
github.com/IBM/sarama v1.41.2
github.com/IBM/vmware-go-sdk v0.1.2
github.com/stretchr/testify v1.9.0
Expand All @@ -77,7 +77,6 @@ require (
require (
cloud.google.com/go/kms v1.10.1 // indirect
cloud.google.com/go/monitoring v1.13.0 // indirect
github.com/Bowery/prompt v0.0.0-20190916142128-fa8279994f75 // indirect
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 // indirect
github.com/PromonLogicalis/asn1 v0.0.0-20190312173541-d60463189a56 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
Expand All @@ -96,7 +95,6 @@ require (
github.com/coreos/pkg v0.0.0-20220810130054-c7d1c02cb6cf // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a // indirect
github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/eapache/go-resiliency v1.4.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
Expand Down Expand Up @@ -129,7 +127,6 @@ require (
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
Expand Down Expand Up @@ -170,7 +167,6 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kardianos/govendor v1.0.9 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/kube-object-storage/lib-bucket-provisioner v0.0.0-20221122204822-d1a8c34382f1 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
Expand All @@ -182,8 +178,6 @@ require (
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/gox v1.0.1 // indirect
github.com/mitchellh/iochan v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/spdystream v0.2.0 // indirect
Expand Down Expand Up @@ -224,9 +218,6 @@ require (
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.16.1 // indirect
golang.org/x/tools/cmd/cover v0.1.0-deprecated // indirect
golang.org/x/tools/go/vcs v0.1.0-deprecated // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
Expand All @@ -250,7 +241,6 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt
// add sdk changes.
replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7


exclude (
github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
Expand Down
Loading

0 comments on commit 6dd26fd

Please sign in to comment.