V
V
VITYA-XY12020-11-13 00:04:02
Amazon Web Services
VITYA-XY1, 2020-11-13 00:04:02

What approach to use using terraform modules?

For example:

You need to create a VPC, attach ec2, rds and elasticache to it.
You need to attach elb to ec2, and to elb, route53
There are ready-made modules:
https://github.com/terraform-aws-modules

Based on the task, the question is:

1) How to make all this friends with each other, those as terraform will know the order of what for create or need to somehow specify dependencies?
2) It is worth using your own or ready-made modules, how to avoid fakups when choosing other people's modules, do you need to re-read all over 9000 lines or just test qa first and hope that the situation will be the same on the production?
3) how to rollback on the terraform: let’s say the runner is launched from the localhost (or from another cloud provider), the connection is broken and the terraform does not have time to deploy all the changes, while some of them are deployed, what to do in this case?

Nubian questions that you can dig up on Google, but nevertheless, everyone solves them in their own way, and this infa interests me.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mureevms, 2020-11-13
@VITYA-XY1

1. Write the first state to create internet access instances. If you are doing this for the first time, it will not be trivial. Here is my code for this, take it to start. Then complicate by screwing new gizmos
2. I would not advise, but there is another opinion, and I would advise you to do it yourself. At least to understand how it works. As understanding comes, you can look towards other people's modules.
3. At the next launch, Terraform itself looks at what is already there and completes what it did not have time before the connection was lost. Also, it displays changes every time it is launched. who will do. Write and apply the first state, you will understand.
As an advice. Use a non-local backend. Since we are talking about AWS, it is better to use the S3 backend. This will make the first setup a little more difficult, but it will make life easier later on and save your nerves.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question