1

I have existing AWS ClinetVPN and currently I'm adding route to this ClientVPN manually using AWS console.

I want to terraform this so I can add any new routes to the exiting AWS ClientVPN using terraform.

How can I use do this by Terraform? I dont have to create any new resources as all the resources already exist.

Now that I have imported the resources I need to import one by one each route from clientVPN and add the definition in main.tf file before running terraform plan

In this way, if I have 20 route then I have to add 20 resource entry in main.tf file. Is there a way, I can just write only one entry and terraform will pick this maybe by using variable? I'm not sure, please help me with this.

  • 1
    Ok. What is your question or problem? – Marcin Sep 13 '21 at 07:09
  • I have existing clientVPN running, Currently we are adding routes manually. We want to terraform it so no one can make manual changes. Trying to follow this link. [link](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_client_vpn_route) How will terraform pick existing routes and how can I add new routes using terraform. – Techhack New Sep 13 '21 at 07:21
  • @Marcin any help from your end. – Techhack New Sep 13 '21 at 11:03

1 Answers1

3

You either have to import the required, pre-existing resources to TF, or pass values for client_vpn_endpoint_id and target_vpc_subnet_id as input parameters to your TF script.

Marcin
  • 215,873
  • 14
  • 235
  • 294
  • Could you please help me with the link or doc I can refer because this is something new to me. – Techhack New Sep 13 '21 at 11:22
  • 1
    @TechhackNew I already provided the link to the `import`. – Marcin Sep 13 '21 at 11:35
  • could you please help me with my latest comment. – Techhack New Sep 14 '21 at 07:43
  • @TechhackNew Sadly your question and comment are unclear. I would suggest making new question, with new details and any TF code you have written so far to solve the problem. Also, acceptance of my answer would be appreciated as it clearly helped you as you imported your resources. – Marcin Sep 14 '21 at 07:47
  • added new question : https://stackoverflow.com/questions/69174714/how-to-add-multiple-aws-clientvpn-routes-using-terraform – Techhack New Sep 14 '21 at 08:57