terraform-oci-oke
terraform-oci-oke copied to clipboard
Support existing VCN in other compartment
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
Support the case that you want to use an existing VCN - which is in a compartment different from the one where you wat to create the cluster
It almost works .... by specifying a vcn_id , but 9: vcn_id = var.create_vcn == true ? module.vcn[0].vcn_id : coalesce(var.vcn_id, data.oci_core_vcns.vcns[0].virtual_networks[0].id) │ ├──────────────── │ │ data.oci_core_vcns.vcns[0].virtual_networks is empty list of object
Right, that's because the data source is looking the VCN up in the same compartment: https://github.com/oracle-terraform-modules/terraform-oci-oke/blob/main/datasource.tf#L7
Can you please elaborate on your use case?
Hi, yes I actually do not need the datasource at all - Im happy to specify var.vcn_id Changing it to
vcn_id = var.create_vcn == true ? module.vcn[0].vcn_id : coalesce(var.vcn_id, try(data.oci_core_vcns.vcns[0].virtual_networks[0].id,""))
for example would solve my issue :) . MAybe as well for the next two lines on the routes ?
The underlying use case is that the existing VCN is centrally maintained in a central network compartment
Ah I see. Looks like you've figured it out already :)
Can you please submit a PR?
https://github.com/oracle-terraform-modules/terraform-oci-oke/pull/564