Skip to content

Commit

Permalink
Adding OpenPages as part of UX030 (#5051)
Browse files Browse the repository at this point in the history
* add openpages service

* fix comments and add sample data parameter

* fix readme sample data example
  • Loading branch information
davedcosta authored Feb 12, 2024
1 parent 134c7bd commit d24bb72
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 0 deletions.
58 changes: 58 additions & 0 deletions examples/ibm-openpages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# OpenPages example

This example shows 1 usage scenario.

#### Scenario 1: Create an OpenPages service instance.

```terraform
resource "ibm_resource_instance" "openpages_instance" {
name = "terraform-automation"
service = "openpages"
plan = "essentials"
location = "global"
resource_group_id = data.ibm_resource_group.default_group.id
parameters_json = <<EOF
{
"aws_region": "us-east-1",
"baseCurrency": "USD",
"initialContentType": "_no_samples",
"selectedSolutions": ["ORM"]
}
EOF
timeouts {
create = "200m"
}
}
To provison your instance with the correct configuration, update the `parameters_json` field with the appropriate values.
```

## Dependencies

- The owner of the `ibmcloud_api_key` has permission to create an OpenPages instance under the specified resource group.

## Configuration

- `ibmcloud_api_key` - An API key for IBM Cloud services. If you don't have one already, go to https://cloud.ibm.com/iam/#/apikeys and create a new key.

## Running the configuration

For the planning phase

```bash
terraform init
terraform plan
```

For the apply phase

```bash
terraform apply
```

For the destroy

```bash
terraform destroy
```
23 changes: 23 additions & 0 deletions examples/ibm-openpages/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
data "ibm_resource_group" "default_group" {
is_default = true
}

resource "ibm_resource_instance" "openpages_instance" {
name = "terraform-automation"
service = "openpages"
plan = "essentials"
location = "global"
resource_group_id = data.ibm_resource_group.default_group.id
parameters_json = <<EOF
{
"aws_region": "us-east-1",
"baseCurrency": "USD",
"initialContentType": "_no_samples",
"selectedSolutions": ["ORM"]
}
EOF

timeouts {
create = "200m"
}
}
4 changes: 4 additions & 0 deletions examples/ibm-openpages/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
provider "ibm" {
ibmcloud_api_key = var.ibmcloud_api_key
region = var.region
}
4 changes: 4 additions & 0 deletions examples/ibm-openpages/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Enter your IBM Cloud API Key. If you don't have one already, go to IBM Cloud to get an API Key: https://cloud.ibm.com/iam#/apikeys
# Use the global region
ibmcloud_api_key = ""
region = "global"
10 changes: 10 additions & 0 deletions examples/ibm-openpages/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
variable "ibmcloud_api_key" {
description = "IBM Cloud API key"
type = string
}

variable "region" {
description = "Region"
type = string
default = "global"
}
7 changes: 7 additions & 0 deletions examples/ibm-openpages/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_providers {
ibm = {
source = "IBM-Cloud/ibm",
}
}
}
27 changes: 27 additions & 0 deletions website/docs/r/resource_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,33 @@ resource "ibm_resource_instance" "instance" {
}
```

### Example to provision an OpenPages service instance
The following example enables you to create a service instance of OpenPages.

```terraform
data "ibm_resource_group" "group" {
name = "default"
}
resource "ibm_resource_instance" "openpages_instance" {
name = "openpages-instance-1"
service = "openpages"
plan = "essentials"
location = "global"
resource_group_id = data.ibm_resource_group.default_group.id
parameters_json = <<EOF
{
"aws_region": "us-east-1",
"baseCurrency": "USD",
"selectedSolutions": ["ORM"]
}
EOF
timeouts {
create = "200m"
}
}
```

## Timeouts

The `ibm_resource_instance` resource provides the following [Timeouts](https://www.terraform.io/docs/language/resources/syntax.html) configuration options:
Expand Down

0 comments on commit d24bb72

Please sign in to comment.