Skip to content

Commit

Permalink
feat: initial module release (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamar7 authored Nov 27, 2024
1 parent 2726e92 commit 3a43a81
Show file tree
Hide file tree
Showing 33 changed files with 522 additions and 211 deletions.
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Primary owner should be listed first in list of global owners, followed by any secondary owners
* @SirSpidey @ocofaigh

* @iamar7 @Aayush-Abhyarthi
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ repository:
# description: ""

# Use a comma-separated list of topics to set on the repo (ensure not to use any caps in the topic string).
topics: terraform, ibm-cloud, terraform-module, core-team
topics: terraform, ibm-cloud, terraform-module, core-team, watsonx.data, lakehouse
89 changes: 43 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<!-- Update this title with a descriptive name. Use sentence case. -->
# Terraform modules template project
# IBM Watsonx.data

<!--
Update status and "latest release" badges:
1. For the status options, see https://terraform-ibm-modules.github.io/documentation/#/badge-status
2. Update the "latest release" badge to point to the correct module's repo. Replace "terraform-ibm-module-template" in two places.
-->
[![Incubating (Not yet consumable)](https://img.shields.io/badge/status-Incubating%20(Not%20yet%20consumable)-red)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
[![Stable (With quality checks)](https://img.shields.io/badge/Status-Stable%20(With%20quality%20checks)-green)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-watsonx-data?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-watsonx-data/releases/latest)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)
Expand All @@ -19,17 +18,14 @@ Expand on the repo short description in the .github/settings.yml file.
For information, see "Module names and descriptions" at
https://terraform-ibm-modules.github.io/documentation/#/implementation-guidelines?id=module-names-and-descriptions
-->

TODO: Replace this with a description of the modules in this repo.


IBM® watsonx.data is a new open architecture lakehouse that combines the elements of the data warehouse and data lakes. For more information visit [here](https://cloud.ibm.com/docs/watsonxdata?topic=watsonxdata-wxd_ov)
<!-- The following content is automatically populated by the pre-commit hook -->
<!-- BEGIN OVERVIEW HOOK -->
## Overview
* [terraform-ibm-watsonx-data](#terraform-ibm-watsonx-data)
* [Examples](./examples)
* [Advanced example](./examples/advanced)
* [Basic example](./examples/basic)
* [Existing instance example](./examples/existing-instance)
* [Contributing](#contributing)
<!-- END OVERVIEW HOOK -->

Expand All @@ -46,74 +42,75 @@ https://terraform-ibm-modules.github.io/documentation/#/implementation-guideline
<!-- Replace this heading with the name of the root level module (the repo name) -->
## terraform-ibm-watsonx-data

### Usage
This module supports provisioning the following:

<!--
Add an example of the use of the module in the following code block.
* Provisioning watsonx.data instance with a selectable service plan

Use real values instead of "var.<var_name>" or other placeholder values
unless real values don't help users know what to change.
-->
### Usage

```hcl
module "watsonx_data" {
source = "terraform-ibm-modules/watsonx-data/ibm"
version = "X.Y.Z" # Replace "X.Y.Z" with a release version to lock into a specific release
watsonx_data_name = "watsonx-data"
region = "us-south"
watsonx_data_plan = "lite"
resource_group_id = "xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX"
}
```

### Required access policies

<!-- PERMISSIONS REQUIRED TO RUN MODULE
If this module requires permissions, uncomment the following block and update
the sample permissions, following the format.
Replace the 'Sample IBM Cloud' service and roles with applicable values.
The required information can usually be found in the services official
IBM Cloud documentation.
To view all available service permissions, you can go in the
console at Manage > Access (IAM) > Access groups and click into an existing group
(or create a new one) and in the 'Access' tab click 'Assign access'.
-->

<!--
You need the following permissions to run this module:
- Service
- **Resource group only**
- `Viewer` access on the specific resource group
- **Sample IBM Cloud** service
- `Editor` platform access
- `Manager` service access
-->

<!-- NO PERMISSIONS FOR MODULE
If no permissions are required for the module, uncomment the following
statement instead the previous block.
-->

<!-- No permissions are needed to run this module.-->
You need the following permissions to run this module.

- Account Management service
- Administrator role

- watsonx.data
- Editor platform
<!-- The following content is automatically populated by the pre-commit hook -->
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
### Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.9.0 |
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >=1.70.1, < 2.0.0 |

### Modules

No modules.

### Resources

No resources.
| Name | Type |
|------|------|
| [ibm_resource_instance.data_instance](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/resource_instance) | resource |
| [ibm_resource_tag.watsonx_data_tag](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/resource_tag) | resource |
| [ibm_resource_instance.existing_watsonx_data_instance](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/resource_instance) | data source |

### Inputs

No inputs.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_access_tags"></a> [access\_tags](#input\_access\_tags) | A list of access tags to apply to the watsonx data instance created by the module. For more information, see https://cloud.ibm.com/docs/account?topic=account-access-tags-tutorial. | `list(string)` | `[]` | no |
| <a name="input_existing_watsonx_data_instance_crn"></a> [existing\_watsonx\_data\_instance\_crn](#input\_existing\_watsonx\_data\_instance\_crn) | The CRN of the an existing watsonx.data instance. If no value is passed, and new instance will be provisioned. | `string` | `null` | no |
| <a name="input_region"></a> [region](#input\_region) | The region to provision the watsonx data instance. | `string` | `"us-south"` | no |
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where the watsonx data instance is created. | `string` | `null` | no |
| <a name="input_resource_tags"></a> [resource\_tags](#input\_resource\_tags) | Optional list of tags to be added to created resources | `list(string)` | `[]` | no |
| <a name="input_watsonx_data_name"></a> [watsonx\_data\_name](#input\_watsonx\_data\_name) | The name of the watsonx.data instance. | `string` | `null` | no |
| <a name="input_watsonx_data_plan"></a> [watsonx\_data\_plan](#input\_watsonx\_data\_plan) | The plan that's used to provision the watsonx.data instance. Allowed values are 'lite' and 'lakehouse-enterprise'. | `string` | `"lite"` | no |

### Outputs

No outputs.
| Name | Description |
|------|-------------|
| <a name="output_watsonx_data_crn"></a> [watsonx\_data\_crn](#output\_watsonx\_data\_crn) | The CRN of the watsonx.data instance. |
| <a name="output_watsonx_data_dashboard_url"></a> [watsonx\_data\_dashboard\_url](#output\_watsonx\_data\_dashboard\_url) | The dashboard URL of the watsonx.data instance. |
| <a name="output_watsonx_data_guid"></a> [watsonx\_data\_guid](#output\_watsonx\_data\_guid) | The GUID of the watsonx.data instance. |
| <a name="output_watsonx_data_name"></a> [watsonx\_data\_name](#output\_watsonx\_data\_name) | The name of the watsonx.data instance. |
| <a name="output_watsonx_data_plan_id"></a> [watsonx\_data\_plan\_id](#output\_watsonx\_data\_plan\_id) | The plan ID of the watsonx.data instance. |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

<!-- Leave this section as is so that your module has a link to local development environment set-up steps for contributors to follow -->
Expand Down
2 changes: 1 addition & 1 deletion common-dev-assets
4 changes: 2 additions & 2 deletions cra-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# More info about this file at https://github.com/terraform-ibm-modules/common-pipeline-assets/blob/main/.github/workflows/terraform-test-pipeline.md#cra-config-yaml
version: "v1"
CRA_TARGETS:
- CRA_TARGET: "examples/advanced" # Target directory for CRA scan. If not provided, the CRA Scan will not be run.
- CRA_TARGET: "examples/basic" # Target directory for CRA scan. If not provided, the CRA Scan will not be run.
CRA_IGNORE_RULES_FILE: "cra-tf-validate-ignore-rules.json" # CRA Ignore file to use. If not provided, it checks the repo root directory for `cra-tf-validate-ignore-rules.json`
PROFILE_ID: "0e6e7b5a-817d-4344-ab6f-e5d7a9c49520" # SCC profile ID (currently set to the FSCloud 1.4.0 profile).
PROFILE_ID: "0c8b9026-9c77-4384-9f6e-7bed5c25c49f" # SCC profile ID (currently set to AI Security Guardrails 2.0 profile).
# SCC_INSTANCE_ID: "" # The SCC instance ID to use to download profile for CRA scan. If not provided, a default global value will be used.
# SCC_REGION: "" # The IBM Cloud region that the SCC instance is in. If not provided, a default global value will be used.
# CRA_ENVIRONMENT_VARIABLES: # An optional map of environment variables for CRA, where the key is the variable name and value is the value. Useful for providing TF_VARs.
Expand Down
4 changes: 0 additions & 4 deletions examples/advanced/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions examples/advanced/main.tf

This file was deleted.

23 changes: 0 additions & 23 deletions examples/advanced/outputs.tf

This file was deleted.

29 changes: 0 additions & 29 deletions examples/advanced/variables.tf

This file was deleted.

12 changes: 0 additions & 12 deletions examples/advanced/version.tf

This file was deleted.

9 changes: 2 additions & 7 deletions examples/basic/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Basic example

<!--
The basic example should call the module(s) stored in this repository with a basic configuration.
Note, there is a pre-commit hook that will take the title of each example and include it in the repos main README.md.
The text below should describe exactly what resources are provisioned / configured by the example.
-->

An end-to-end basic example that will provision the following:

- A new resource group if one is not passed in.
- A new Cloud Object Storage instance.
- A watsonx.data instance
17 changes: 9 additions & 8 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
########################################################################################################################
# Resource group
# Resource Group
########################################################################################################################

module "resource_group" {
Expand All @@ -11,14 +11,15 @@ module "resource_group" {
}

########################################################################################################################
# COS instance
# Watsonx Data
########################################################################################################################

resource "ibm_resource_instance" "cos_instance" {
name = "${var.prefix}-cos"
module "watsonx_data" {
source = "../../"
region = var.region
resource_group_id = module.resource_group.resource_group_id
service = "cloud-object-storage"
plan = "standard"
location = "global"
tags = var.resource_tags
watsonx_data_name = "${var.prefix}-data-instance"
watsonx_data_plan = "lite"
access_tags = var.access_tags
resource_tags = var.resource_tags
}
34 changes: 27 additions & 7 deletions examples/basic/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,37 @@
# Outputs
########################################################################################################################

output "cos_instance_id" {
description = "COS instance id"
value = ibm_resource_instance.cos_instance.id
output "watsonx_data_crn" {
description = "The CRN of the watsonx.data instance."
value = module.watsonx_data.watsonx_data_crn
}

output "resource_group_name" {
description = "Resource group name"
value = module.resource_group.resource_group_name
output "watsonx_data_dashboard_url" {
description = "The dashboard URL of the watsonx.data."
value = module.watsonx_data.watsonx_data_dashboard_url
}

output "watsonx_data_guid" {
description = "The GUID of the watsonx.data instance."
value = module.watsonx_data.watsonx_data_guid
}

output "watsonx_data_name" {
description = "The name of the watsonx.data instance."
value = module.watsonx_data.watsonx_data_name
}

output "watsonx_data_plan_id" {
description = "The plan ID of the watsonx.data instance."
value = module.watsonx_data.watsonx_data_plan_id
}

output "resource_group_id" {
description = "Resource group ID"
description = "The resource group ID to provision the watsonx.data instance."
value = module.resource_group.resource_group_id
}

output "resource_group_name" {
description = "The resource group name to provision the watsonx.data instance."
value = module.resource_group.resource_group_name
}
20 changes: 13 additions & 7 deletions examples/basic/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# Input variables
########################################################################################################################

variable "resource_group" {
type = string
description = "An existing resource group name to use for this example. If not specified, a new resource group is created."
default = null
}

variable "ibmcloud_api_key" {
type = string
description = "The IBM Cloud API Key"
Expand All @@ -10,20 +16,20 @@ variable "ibmcloud_api_key" {

variable "region" {
type = string
description = "Region to provision all resources created by this example"
description = "Region to provision all resources created by this example."
default = "us-south"
}

variable "prefix" {
type = string
description = "Prefix to append to all resources created by this example"
default = "basic"
description = "The prefix to add to all resources created by this example."
default = "watsonx"
}

variable "resource_group" {
type = string
description = "The name of an existing resource group to provision resources in to. If not set a new resource group will be created using the prefix variable"
default = null
variable "access_tags" {
type = list(string)
description = "Optional list of access management tags to add to the watsonx data instance"
default = []
}

variable "resource_tags" {
Expand Down
7 changes: 2 additions & 5 deletions examples/basic/version.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
terraform {
required_version = ">= 1.3.0"

# Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main
# module's version.tf (usually a basic example), and 1 example that will always use the latest provider version.
required_version = ">= 1.9.0"
required_providers {
ibm = {
source = "IBM-Cloud/ibm"
version = "1.49.0"
version = ">= 1.70.1"
}
}
}
Loading

0 comments on commit 3a43a81

Please sign in to comment.