Sample project to explore terraform with nginx as api gateway.
Nginx will route the traffic to respective servers based on api key.
+---------+ auth +--------+
| gateway | -----+-----> | hello0 |
+---------+ | +--------+
|
| +--------+
+-----> | hello1 |
+--------+
User data will always run on restart.
Terraform is required for deployment to aws.
terraform apply
To test it out. Request with header X-Api-Key
with terraform output.
Can try it with either key0
or key1
.
> curl 3.0.146.21 -X 'X-Api-Key: key0'
hello0