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

ibm_is_region make name optional #1258

Closed
wderezin opened this issue Apr 1, 2020 · 0 comments · Fixed by #3431
Closed

ibm_is_region make name optional #1258

wderezin opened this issue Apr 1, 2020 · 0 comments · Fixed by #3431
Assignees
Labels
service/VPC Infrastructure Issues related to the VPC Infrastructure

Comments

@wderezin
Copy link
Contributor

wderezin commented Apr 1, 2020

Terraform Version

version 0.11 and 0.12

Affected Resource(s)

Please list the resources as a list, for example:

  • ibm_is_region

Making the name argument optional will provide 2 use cases.

  1. Being able to query the current region configured from the environment.
data "ibm_is_region" "current" {}

resource ibm_database standalone {
  ... 
  region = data.ibm_is_region.current.name
}
  1. In modules needing providers.

Example of calling the module

provider "ibm" {
  region = "us-east"
  alias = "east"
}

provider "ibm" {
  region = "us-south"
  alias  = "south"
}

module "database_with_replica" {
    providers {
       ibm.primary = "ibm.east
       ibm.secondary = "ibm.south"
  }
}

Example of the module main.tf

provider "ibm" {
  alias = "primary"
}
provider "ibm" {
  alias = "secondary"
}

data ibm_is_region primary {
   provider = ibm.primary
}
data ibm_is_region secondary {
  provider = ibm.secondary
}

resource ibm_database primary {
   ...
   region = data.ibm_is_region.primary.name
}
resource ibm_database replica {
  ...
  region = data.ibm_is_region.secondary.naem
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/VPC Infrastructure Issues related to the VPC Infrastructure
Projects
None yet
3 participants