opentelekomcloud / terraform-otc

Terraform integration modules for Open Telekom Cloud
22 stars 19 forks source link

Use of existing VPC and subnet #15

Closed vinayakbhat24 closed 7 years ago

vinayakbhat24 commented 7 years ago

Can you please give suggestions on how to use existing VPC and subnet? I dont want to create new one.

Crapworks commented 7 years ago

@vinayakbhat24 to get your existing resources into your terraform statefile, you can use the import functionality: https://www.terraform.io/docs/import/usage.html

A VPC consists of 4 OpenStack resources:

As stated in the link I've provided, you have to create the resource definition by yourself, then import the existing resources. From that point on, they will be managed via terraform.

As it is right now, only the network and subnet resources are importable. But there are already PRs for router and router_interface that you can watch here:

As soon as they are merged (shouldn't take longer than a week) you can import the full VPC.

Cheers, Christian

vinayakbhat24 commented 7 years ago

Hi Christian, Thanks, Is there any way to see subnet id in otc console. Best Regards,

ogaida commented 7 years ago

Hi Vinayak,

you could use otc.sh from https://github.com/OpenTelekomCloud/otc-tools . There is a docker image you could use: https://hub.docker.com/r/tsiotc/otc-client . Then run:

./otc.sh subnet list

best regards Oliver

vinayakbhat24 commented 7 years ago

Hi Oliver,

Thanks, I was using docker image only. But there is some authentication issue. That's why just wanted to know is there any other way without using CLI commands. First, let me try to resolve authentication issue then.

Best Regards,

Crapworks commented 7 years ago

@vinayakbhat24

You can see the subnet ID also in the OTC console. From the Home Screen you select "Virtual Private Cloud" and then "Subnets". Ich you have multiple VPCs you can choose one on the left in the dropdown menu. On the right you see your existing subnets, including the ID.

Cheers, Christian

P.S. The pull request I've linked are already merged and released. So you can update your plugins (it should work with openstack provider 0.2.2) and you are ready to go.