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

region is required for google_compute_subnetwork #22

Merged
merged 1 commit into from
Oct 25, 2018

Conversation

sunggun-yu
Copy link
Contributor

My environment is on GKE with shared VPC network.
And, I've got an error below when I tried 'terraform plan'. I believe this PR fix my issue.

data.google_compute_subnetwork.gke_subnetwork: Cannot determine region: set in this resource, or set provider-level 'region' or 'zone'.

Terraform Code:

module "gke-cluster-my-cluster" {
  source              = "github.com/terraform-google-modules/terraform-google-kubernetes-engine"
  project_id          = "my_project"
  name                = "my_cluster"
  kubernetes_version  = "1.10.6-gke.2"
  regional            = false
  region              = "us-east4"
  zones               = ["us-east4-a"]
  network_project_id  = "my_network_project"
  network             = "my_network"
  subnetwork          = "my_subnet"
  ip_range_pods       = "my_cidr_container"
  ip_range_services   = "my_cidr_service"
  network_policy      = true
  http_load_balancing = true

  node_pools = [
    {
      name                     = "my_node_pool"
      image_type               = "COS"
      instance_service_account = "my_service_account@my_project.iam.gserviceaccount.com"
      machine_type             = "n1-standard-32" # 32 CPU / 120 GB Memory
      min_count                = "1"
    },
  ]

  node_pools_tags = {
    all = []
    my_node_pool = [
      "allow-k8s-services-internal",
      "allow-k8s-services-external",
    ]
  }

  node_pools_labels = {
    all = {}
    my_node_pool = {}
  }

  node_pools_taints = {
    all = []
    my_node_pool = []
  }

  non_masquerade_cidrs = [
    "${data.google_compute_subnetwork.my_subnet.secondary_ip_range.0.ip_cidr_range}",
    "${data.google_compute_subnetwork.my_subnet.secondary_ip_range.1.ip_cidr_range}",
  ]

  stub_domains         {
    "some_domain_1" = ["some_ip","some_ip"]
    "some_domain_2" = ["some_ip","some_ip"]
    "some_domain_3" = ["some_ip","some_ip"]
  }
}

@Jberlinsky
Copy link
Contributor

@sunggun-yu, thank you for your contribution! I'm glad this seems to have resolved the problems you encountered.

In attempting to reproduce this, I encountered a few additional changes that need to be made while we're in here. In particular, if your subnetwork and network are in different projects, this still won't work properly.

I've created #23 to track this issue, and expect to be working on this in the next couple days. Your change here will be incorporated into the resulting pull request. As such, I'm going to close this one.

Once again, thank you for reporting this!

@Jberlinsky Jberlinsky closed this Oct 25, 2018
@morgante morgante reopened this Oct 25, 2018
@Jberlinsky
Copy link
Contributor

@sunggun-yu, my apologies. The issues I referenced stem from a different set of circumstances. I'm going to run our test suite on your change and get it merged in if everything passes.

@Jberlinsky
Copy link
Contributor

Looks good, merging!

@Jberlinsky Jberlinsky merged commit 6dbeb4d into terraform-google-modules:master Oct 25, 2018
@sunggun-yu
Copy link
Contributor Author

@Jberlinsky, @morgante Thank you so much!!!

CPL-markus pushed a commit to WALTER-GROUP/terraform-google-kubernetes-engine that referenced this pull request Jul 15, 2024
…tworks

`region` is required for `google_compute_subnetwork`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants