-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: added modules for single function with secret tests
- Loading branch information
Showing
4 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
data "qernal_provider" "digitalocean" { | ||
name = "digitalocean" | ||
} | ||
|
||
resource "qernal_function" "function" { | ||
project_id = var.project_id | ||
version = "1.0.0" | ||
name = var.function_name | ||
description = "Hello world" | ||
image = "testcontainers/helloworld:1.1.0" | ||
port = 80 | ||
type = "http" | ||
|
||
scaling = { | ||
high = 80 | ||
low = 20 | ||
type = "cpu" | ||
} | ||
|
||
size = { | ||
cpu = 128 | ||
memory = 128 | ||
} | ||
compliance = ["ipv6"] // TODO: allow this to be blank | ||
|
||
deployment { | ||
location = { | ||
provider_id = data.qernal_provider.digitalocean.id | ||
country = "GB" | ||
} | ||
|
||
replicas = { | ||
min = 1 | ||
max = 1 | ||
affinity = { | ||
cloud = false | ||
cluster = false | ||
} | ||
} | ||
} | ||
|
||
route { | ||
path = "/*" | ||
methods = ["GET", "HEAD"] | ||
weight = 100 | ||
} | ||
|
||
secrets = [ | ||
{ | ||
name = "ENV_VAR" | ||
reference = var.secret_reference | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
variable "project_id" { | ||
type = string | ||
} | ||
|
||
variable "function_name" { | ||
type = string | ||
} | ||
|
||
variable "secret_reference" { | ||
type = string | ||
} |
59 changes: 59 additions & 0 deletions
59
tests/modules/single_function_with_secret_datasource/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
data "qernal_provider" "digitalocean" { | ||
name = "digitalocean" | ||
} | ||
|
||
data "qernal_secret_environment" "env_secret" { | ||
project_id = var.project_id | ||
name = var.secret_name | ||
} | ||
|
||
resource "qernal_function" "function" { | ||
project_id = var.project_id | ||
version = "1.0.0" | ||
name = var.function_name | ||
description = "Hello world" | ||
image = "testcontainers/helloworld:1.1.0" | ||
port = 80 | ||
type = "http" | ||
|
||
scaling = { | ||
high = 80 | ||
low = 20 | ||
type = "cpu" | ||
} | ||
|
||
size = { | ||
cpu = 128 | ||
memory = 128 | ||
} | ||
compliance = ["ipv6"] // TODO: allow this to be blank | ||
|
||
deployment { | ||
location = { | ||
provider_id = data.qernal_provider.digitalocean.id | ||
country = "GB" | ||
} | ||
|
||
replicas = { | ||
min = 1 | ||
max = 1 | ||
affinity = { | ||
cloud = false | ||
cluster = false | ||
} | ||
} | ||
} | ||
|
||
route { | ||
path = "/*" | ||
methods = ["GET", "HEAD"] | ||
weight = 100 | ||
} | ||
|
||
secrets = [ | ||
{ | ||
name = "ENV_VAR" | ||
reference = qernal_secret_environment.env_secret.reference | ||
} | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/modules/single_function_with_secret_datasource/vars.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
variable "project_id" { | ||
type = string | ||
} | ||
|
||
variable "function_name" { | ||
type = string | ||
} | ||
|
||
variable "secret_name" { | ||
type = string | ||
} |