abes140377 / yade-generator-cli

1 stars 0 forks source link

Feature: "http" backend for terraform #8

Open izerecord opened 1 week ago

izerecord commented 1 week ago

Maybe preconfigured to the point, that only the project-id must be inserted. E.g.:

backend "http" {
  address                = "https://<gitlab-address>/api/v4/projects/<insert-project-id>/terraform/state/<idk>-<idk-stage>-tfstate"
  lock_address           = "https://<gitlab-address>/api/v4/projects/<insert-project-id>/terraform/state/<idk>-<idk-stage>-tfstate/lock"
  unlock_address         = "https://<gitlab-address>/api/v4/projects/<insert-project-id>/terraform/state/<idk>-<idk-stage>-tfstate/lock"
  lock_method            = "POST"
  unlock_method          = "DELETE"
  retry_wait_min         = 5
  skip_cert_verification = true
}

Maybe the project-id is automatically given. I wrote something previously with bash which could be helpful. The snippet is out of context of course.

GIT_REMOTE_ORIGIN=$(git config --get remote.origin.url)
GIT_REMOTE_ORIGIN_PATH_WITH_NAMESPACE=$(echo $GIT_REMOTE_ORIGIN | cut -d":" -f2 | cut -d"." -f1)

GITLAB_PROJECT_ID=$(curl --insecure --silent \
https://$GITLAB_URL/api/v4/projects/${GIT_REMOTE_ORIGIN_PATH_WITH_NAMESPACE//\//%2F} | jq ".id")

Maybe doctor.sh can verify this?

Considering multiple VMs in multiple phases, I don't know how this could ideally be done.