forked from IBM-Cloud/terraform-provider-ibm
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ins-vol-att
- Loading branch information
Showing
84 changed files
with
4,156 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# This example shows how to create an instance of IBM Db2 SaaS on IBM Cloud and configure connectivity from a VSI | ||
|
||
This sample provisions an IBM Db2 SaaS instance on IBM Cloud. | ||
|
||
## Costs | ||
|
||
This sample uses chargable services and **will** incur costs for the time the services are deployed. Execution of `terraform destroy` will result in deletion of all resources including the Db2 SaaS service instance. Billing for Db2 SaaS will terminate on the hour. | ||
|
||
|
||
## Dependencies | ||
|
||
- User has IAM permissions to create and configure an IBM Db2 SaaS for IBM Cloud Instance in the resource group specified. | ||
|
||
## Configuration | ||
|
||
The terraform template requires you to provide values for the terraform variables. | ||
Copy the file `variables.tfvars.example` as `variables.tfvars`. Provide appropriate values to the variables within the file. | ||
|
||
The following variables need to be set in the `terraform.tfvars` file before use: | ||
|
||
* `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. | ||
* `region` - IBM Cloud region where your Db2 SaaS will be created. | ||
* `resource_group` - Resource group within which Db2 SaaS will be created. | ||
|
||
|
||
The example is deployed in the us-south region. The `region` parameter in main.tf must be set to the same region as the Db2 SaaS instance will be deployed in as defined by the `location` parameter on the ibm_db2 resource. | ||
|
||
## Outputs | ||
|
||
The composed connection string of Db2 SaaS Instance CRN. `crn:v1:bluemix:public:dashdb-for-transactions:us-south:a/60970f92286548d8a64cbb45bce39bc1:deae06ff-3966-4534-bfa0-4b42281e7cef::` | ||
|
||
|
||
## Running the configuration | ||
1. Initialize the terraform project to download the terraform providers and modules | ||
```bash | ||
$ terraform init | ||
``` | ||
2. Perform terraform plan with the variables. Run `terraform plan` to see the changes that will be applied to your account after you make any change to the terraform code. | ||
```bash | ||
$ terraform plan -var-file=./variables.tfvars | ||
``` | ||
|
||
3. Perform terraform apply with the variables. Run `terraform apply` to apply the changes to the IBM Cloud after that will be applied to your account after you make any change to the terraform code. | ||
|
||
```bash | ||
$ terraform apply -var-file=./variables.tfvars | ||
``` | ||
|
||
Run `terraform destroy` to clean up and destroy all the resources created for the toolchain. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
data "ibm_resource_group" "group" { | ||
name = var.resource_group | ||
} | ||
|
||
//Db2 SaaS Instance Creation | ||
resource "ibm_db2" "db2_instance" { | ||
name = "demo-db2" | ||
service = "dashdb-for-transactions" | ||
plan = "performance" | ||
location = var.region | ||
resource_group_id = data.ibm_resource_group.group.id | ||
service_endpoints = "public-and-private" | ||
instance_type = "bx2.4x16" | ||
high_availability = "yes" | ||
backup_location = "us" | ||
|
||
parameters_json = <<EOF | ||
{ | ||
"disk_encryption_instance_crn": "none", | ||
"disk_encryption_key_crn": "none", | ||
"oracle_compatibility": "no" | ||
} | ||
EOF | ||
|
||
timeouts { | ||
create = "720m" | ||
update = "60m" | ||
delete = "30m" | ||
} | ||
} | ||
|
||
# //DataSource reading existing instance | ||
# data "ibm_db2" "db2_instance" { | ||
# name = "demo-db2" | ||
# resource_group_id = data.ibm_resource_group.group.id | ||
# location = var.region | ||
# service = "dashdb-for-transactions" | ||
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
provider "ibm" { | ||
ibmcloud_api_key = var.ibmcloud_api_key | ||
region = var.region | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
variable "ibmcloud_api_key" { | ||
description = "Enter your IBM Cloud API Key, you can get your IBM Cloud API key using: https://cloud.ibm.com/iam#/apikeys" | ||
type = string | ||
} | ||
|
||
variable "region" { | ||
type = string | ||
description = "IBM Cloud region where your IBM Db2 SaaS will be created" | ||
default = "us-south" | ||
} | ||
|
||
variable "resource_group" { | ||
type = string | ||
description = "Resource group within which IBM Db2 SaaS will be created" | ||
default = "Default" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ibmcloud_api_key = "<ibm-cloud-api-key>" | ||
region = "<ibm-cloud-region>" | ||
resource_group = "<ibm-cloud-resource-group>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = ">= 1.2.0, < 2.0.0" | ||
|
||
required_providers { | ||
ibm = { | ||
source = "IBM-Cloud/ibm" | ||
version = ">= 1.71.3-beta1" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.