Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding OpenPages as part of UX030 #5051

Merged
merged 3 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading