diff --git a/.woodpecker/deplyoment.yaml b/.woodpecker/deplyoment.yaml new file mode 100644 index 0000000..2156c11 --- /dev/null +++ b/.woodpecker/deplyoment.yaml @@ -0,0 +1,13 @@ +when: + - event: push + branch: main + +depends_on: + - test + - playwright + +steps: + - name: terraform + image: hashicorp/terraform:latest + commands: + - terraform plan diff --git a/.woodpecker/release.yml b/.woodpecker/release.yml index d2c6d90..e86569a 100644 --- a/.woodpecker/release.yml +++ b/.woodpecker/release.yml @@ -1,4 +1,3 @@ - when: - event: push branch: main diff --git a/resources/infra/.gitignore b/resources/infra/.gitignore new file mode 100644 index 0000000..c035e72 --- /dev/null +++ b/resources/infra/.gitignore @@ -0,0 +1,2 @@ +.terraform +.terraform.lock.hcl diff --git a/resources/infra/backend.tf b/resources/infra/backend.tf new file mode 100644 index 0000000..5cfa6b7 --- /dev/null +++ b/resources/infra/backend.tf @@ -0,0 +1,23 @@ +terraform { + backend "s3" { + bucket = "miniauth-terraform" + key = "terraform.tfstate" + region = "fr-par" + endpoints = { s3 = "https://s3.fr-par.scw.cloud" } + profile = "miniauth" + skip_credentials_validation = true + skip_region_validation = true + skip_requesting_account_id = true + } +} + + +/* +For the credentials part: +==> Create a ~/.aws/credentials: +[miniauth] +aws_access_key_id=<SCW_ACCESS_KEY> +aws_secret_access_key=<SCW_SECRET_KEY> +region=fr-par +*/ + diff --git a/resources/infra/provider.tf b/resources/infra/provider.tf new file mode 100644 index 0000000..8909456 --- /dev/null +++ b/resources/infra/provider.tf @@ -0,0 +1,15 @@ + +terraform { + required_providers { + scaleway = { + source = "scaleway/scaleway" + } + } + required_version = ">= 0.13" +} +provider "scaleway" { + project_id = "d7b7ab2d-478c-44af-9f66-f90af976a779" + zone = "fr-par-1" + region = "fr-par" +} + diff --git a/resources/infra/scw-container.tf b/resources/infra/scw-container.tf new file mode 100644 index 0000000..33b760e --- /dev/null +++ b/resources/infra/scw-container.tf @@ -0,0 +1,30 @@ +resource "scaleway_container_namespace" "miniauth" { + name = "miniauth" + description = "Miniauth for gutes team" + project_id = "d7b7ab2d-478c-44af-9f66-f90af976a779" +} + + +resource "scaleway_container" "main" { + name = "miniauth-webgui" + description = "The webpage for the user authentification" + namespace_id = scaleway_container_namespace.miniauth.id + registry_image = "git.keks.cloud/kekskurse/miniauth:latest" + port = 8080 + cpu_limit = 100 + memory_limit = 128 + min_scale = 0 + max_scale = 1 + timeout = 600 + privacy = "public" + protocol = "http1" + deploy = true + http_option = "redirected" + + environment_variables = { + "foo" = "var" + } + secret_environment_variables = { + "key" = "secret" + } +}