Skip to content

Commit

Permalink
Merge pull request #315 from dasmeta/DMVP-2604-ingress-refactoring
Browse files Browse the repository at this point in the history
fix(DMVP-2604): Fixed ingress redirection bug
  • Loading branch information
viktoryathegreat authored Aug 21, 2023
2 parents 56365a6 + a9cc875 commit 65c08fc
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 6 deletions.
27 changes: 21 additions & 6 deletions modules/ingress/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,27 @@ locals {
group_name = var.name

//dummy_path has to he specified by default otherwise ingress can't be built
dummy_path = [{
name = "response-static"
port = null
path = "/Pto48SjdzKBclyL5"
static_port = "use-annotation"
}]
dummy_path = var.ssl_redirect == true ? [
{
name = "response-static"
port = null
path = "/Pto48SjdzKBclyL5"
static_port = "use-annotation"
},
{
name = "ssl-redirect"
port = null
path = "/*"
static_port = "use-annotation"
}
] : [
{
name = "response-static"
port = null
path = "/Pto48SjdzKBclyL5"
static_port = "use-annotation"
}
]

annotations = {
"alb.ingress.kubernetes.io/load-balancer-name" = var.name
Expand Down
29 changes: 29 additions & 0 deletions modules/ingress/tests/basic/0-setup.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
terraform {
required_providers {
test = {
source = "terraform.io/builtin/test"
}

aws = {
source = "hashicorp/aws"
version = ">= 3.41"
}

kubernetes = {
source = "hashicorp/kubernetes"
version = ">= 2.0.0"
}
}

required_version = ">= 1.3.0"
}

/**
* set the following env vars so that aws provider will get authenticated before apply:
export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxx
*/
provider "aws" {
region = "eu-central-1"
}
20 changes: 20 additions & 0 deletions modules/ingress/tests/basic/1-example.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
data "aws_acm_certificate" "issued" {
domain = "*.devops.dasmeta.com"
statuses = ["ISSUED"]
}


module "ingress" {
source = "../.."

name = "dev"
hostname = "*.devops.dasmeta.com"
scheme = "internal"
namespace = "nginx"

certificate_arn = data.aws_acm_certificate.issued.arn
healthcheck_path = "/health"
healthcheck_success_codes = "200-399"

tls_hosts = ["*.devops.dasmeta.com"]
}
9 changes: 9 additions & 0 deletions modules/ingress/tests/basic/2-assert.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "test_assertions" "dummy" {
component = "this"

equal "scheme" {
description = "As module does not have any output and data just make sure the case runs. Probably can be thrown away."
got = "all good"
want = "all good"
}
}
39 changes: 39 additions & 0 deletions modules/ingress/tests/basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# basic

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.41 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.0.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.41 |
| <a name="provider_test"></a> [test](#provider\_test) | n/a |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_ingress"></a> [ingress](#module\_ingress) | ../.. | n/a |

## Resources

| Name | Type |
|------|------|
| test_assertions.dummy | resource |
| [aws_acm_certificate.issued](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/acm_certificate) | data source |

## Inputs

No inputs.

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

0 comments on commit 65c08fc

Please sign in to comment.