terraform-ibm-modules / terraform-ibm-watsonx-saas-da

A deployable architecture solution to deploy IBM Watsonx SaaS resources.
Apache License 2.0
2 stars 1 forks source link

Support deploying some of the watson services in jp-tok region. #89

Closed vburckhardt closed 3 months ago

vburckhardt commented 3 months ago

Description

Use case: some customers want to deploy some of the watson services in jp-tok region.

Issue: currently, the location field is set to allow only the regions that are supported by ALL watson service.

2 approaches:

andreainnocenti commented 3 months ago

The cleanest way is to use this feature https://github.com/hashicorp/terraform/issues/25609 at plan time. Unfortunately terraform v1.9 is not yet available and we don't know when it will be avaliable in Schematics.

Let's do this with a check block https://developer.hashicorp.com/terraform/language/checks, do you agree?

vburckhardt commented 3 months ago

@andreainnocenti - here is an example of the way it is typically done with current version of terraform. https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc/blob/05e504dbd0e3057171616ec98bfb9f96d7d45813/main.tf#L22

check block assertion cannot be applied here as they won't block execution (just surface a warning)

mkrudele commented 3 months ago

Before going ahead and implement, we must first understand if the watsonx platform works with services deployed in different regions, and which ones can be deployed in different regions.

andreainnocenti commented 3 months ago
Service Regions
Watson Machine Learning jp-tok,eu-gb,eu-de,us-south
Watson Studio jp-tok,eu-gb,eu-de,us-south
watsonx.governance eu-de,us-south
watsonx Assistant au-syd,jp-tok,eu-gb,eu-de,us-south,us-east
Watson Discovery au-syd,jp-tok,eu-gb,eu-de,us-south,us-east
watsonx.data au-syd, jp-tok, eu-gb, eu-de, us-south
Cloud Object Storage it must be in the same region of Watson Machine Learning
Key Protect it must be in the same region of Watson Machine Learning
andreainnocenti commented 3 months ago

the final decision was to allow the regions jp-tok,eu-gb,eu-de,us-south and add a check on watsonx.governance

  lifecycle {
    precondition {
      condition     = contains(["eu-de", "us-south"], var.location)
      error_message = "watsonx.governance is only available in eu-de and us-south region."
    }
  }

in this way the plan fails

Screenshot 2024-06-21 at 07 47 59