Skip to content

Instantly share code, notes, and snippets.

@devraj
Last active July 5, 2023 04:19
Show Gist options
  • Save devraj/8bcd352ba760608497c2df004ce188bd to your computer and use it in GitHub Desktop.
Save devraj/8bcd352ba760608497c2df004ce188bd to your computer and use it in GitHub Desktop.
HCL clip to install your own apps via terraform
# This demonstrates the deployment of our application via a helm chart
# which is hosted in Github container registry
resource "helm_release" "lab-python-mock-server" {
name = "lab-python-mock-server"
repository = "oci://ghcr.io/anomaly/charts"
chart = "lab-python-mock-server"
namespace = "lab-python-mock-server"
create_namespace = true
depends_on = [
helm_release.aws-load-balancer-controller,
]
}
# Use the AWS provider to get information about load balancers provisioned
# this is not available as a result of the helm chart as all the chart
# does is execute a kubectl apply command
#
# TODO: what happens when there are multiple apps running in the same cluster
# can we use namespaces or labels to filter the results?
data "aws_lb" "load_balancer" {
depends_on = [
helm_release.aws-load-balancer-controller
]
}
# Make available the ingress information available
# This will have more than just the DNS name
output "ingress" {
value = data.aws_lb.load_balancer
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment