Usually, if you already have the existing infrastructure you would build your own Terraform module flexible enough to import it to terraform. I'll make a video soon on how you can bring existing infra under terraform control. There is also a shared VPC concept in GCP. You can create a host project with shared VPC and your "service" projects will reuse existing subnets but won't be able to make any network modifications such as firewalls. It's done to centralize control of the network in one place.
Anton, I'm loving your content, please don't stop uploading. I do want to ask one thing, it is seems GCP concept for private/public subnet is different from the AWS concept. I followed your video successfully creating my VPC, however, if I place an instance with a public IP in my private subnet, it doesn't use created NAT. Only if the instance I deploy has no external IP, it works as expected. Did I miss something or this behaviour is by design? Any way to enforce it on private subnets?
🔴 - To support my channel, I’d like to offer Mentorship/On-the-Job Support/Consulting - me@antonputra.com
You're doing great service to the community, thanks ❤️
I appreciate that!
Thanks for the video.. Also I think you should have extended the video by creating a compute and sshing into it... That would give a full e2e..
Thanks for the idea!
Спасибо за видос!:) Прямо выручил!
pozhaluysta :)
Anton, how do we make use of the existing VPC and its subnet to attach them to a new VM Instance?
Usually, if you already have the existing infrastructure you would build your own Terraform module flexible enough to import it to terraform. I'll make a video soon on how you can bring existing infra under terraform control. There is also a shared VPC concept in GCP. You can create a host project with shared VPC and your "service" projects will reuse existing subnets but won't be able to make any network modifications such as firewalls. It's done to centralize control of the network in one place.
Why are you using locals instead of the variables?
Anton, I'm loving your content, please don't stop uploading.
I do want to ask one thing, it is seems GCP concept for private/public subnet is different from the AWS concept. I followed your video successfully creating my VPC, however, if I place an instance with a public IP in my private subnet, it doesn't use created NAT. Only if the instance I deploy has no external IP, it works as expected.
Did I miss something or this behaviour is by design? Any way to enforce it on private subnets?
Thank you, yes, it's a little bit different. You can go to VPC Network/Routes and delete your "default" route "0.0.0.0/0" to the internet gateway.
Can you provide the steps if nat_ip_allocate_option is set to manual.
Sure - github.com/antonputra/tutorials/blob/08648d9fabec9938062b95ee370afe6d50ee762e/lessons/148/terraform/5-nat.tf#L20
👉 How to Manage Secrets in Terraform - th-cam.com/video/3N0tGKwvBdA/w-d-xo.html
👉 Terraform Tips & Tricks - th-cam.com/video/7S94oUTy2z4/w-d-xo.html
👉 ArgoCD Tutorial - th-cam.com/video/zGndgdGa1Tc/w-d-xo.html