Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rgl/terraform-azure-container-instances-vagrant
Azure Container Instances Container Group with Caddy (for Let's Encrypt TLS Certificate) reverse proxy for an internal test container
https://github.com/rgl/terraform-azure-container-instances-vagrant
azure azure-container-instances lets-encrypt terraform vagrant
Last synced: 13 days ago
JSON representation
Azure Container Instances Container Group with Caddy (for Let's Encrypt TLS Certificate) reverse proxy for an internal test container
- Host: GitHub
- URL: https://github.com/rgl/terraform-azure-container-instances-vagrant
- Owner: rgl
- Created: 2021-12-08T07:15:18.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-21T06:38:19.000Z (3 months ago)
- Last Synced: 2024-10-04T18:41:24.293Z (3 months ago)
- Topics: azure, azure-container-instances, lets-encrypt, terraform, vagrant
- Language: HCL
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# About
This shows how to create a [Azure Container Instances Container Group](https://docs.microsoft.com/en-us/azure/container-instances/container-instances-container-groups) with [Caddy (for Let's Encrypt TLS Certificate)](https://hub.docker.com/_/caddy) reverse proxy for an internal test container.
This is wrapped in a vagrant environment to make it easier to play with this stack without changing your local machine.
## Usage
If you are using Hyper-V, [configure Hyper-V in your local machine](https://github.com/rgl/windows-vagrant#hyper-v-usage).
If you are using libvirt, you should already known what to do.
Start the vagrant environment:
```bash
vagrant up --no-destroy-on-error
```Enter the created vagrant environment and play with the example terraform project:
```bash
# enter the vagrant environment.
vagrant ssh# login into azure.
az login# list the subscriptions.
az account list --all
az account show# set the subscription.
export ARM_SUBSCRIPTION_ID=""
az account set --subscription "$ARM_SUBSCRIPTION_ID"# provision the example infrastructure.
cd /vagrant
export CHECKPOINT_DISABLE=1
export TF_LOG=TRACE
export TF_LOG_PATH=terraform.log
terraform init
terraform plan -out=tfplan
time terraform apply tfplan# use the app.
wget -qSO- "$(terraform output -raw url)"# show the app logs.
# NB to show all the containers logs omit --container app.
az container logs \
--resource-group rgl-terraform-container-instances-example \
--name example \
--container app \
--follow# destroy the infrastructure.
terraform destroy
```## Caveats
* [There is no way to known the end-user client IP address](https://feedback.azure.com/d365community/idea/c81db3f3-0c25-ec11-b6e6-000d3a4f0858).
* **NB** The ACI container is behind a load balancer that does not preserve the client IP address.## Reference
* [azurerm_container_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/container_group)
* [Container groups in Azure Container Instances](https://docs.microsoft.com/en-us/azure/container-instances/container-instances-container-groups)
* [YAML reference: Azure Container Instances](https://docs.microsoft.com/en-us/azure/container-instances/container-instances-reference-yaml)
* [Caddy](https://github.com/caddyserver/caddy)
* [Caddy Docker Image](https://github.com/caddyserver/caddy-docker)