terraform-tofu-labs/4-gitlab-ci/README.md
2024-04-16 23:00:19 +01:00

1.6 KiB

Introduction

First off this lab is entirely optional and also not for the faint hearted. Gitlab CI is currently introducing components to replace the current templates and openTofu will be updated to that as soon as they are supported in self managed runners. If you're not comfortable experimenting and cleaning things up in AWS manually don't do this lab

Get AWS Credentials for Gitlab

Log into the AWS console and head to the IAM service. In here you need to create a new user called gitlab.

# This template is a port of the OpenTofu CI/CD component at
# https://gitlab.com/components/opentofu
# It is generated with the `make backports` command from that project.
#
# Please make sure to use the component when your project is hosted on GitLab.com
# or when you are willing to mirror the component project into your self-managed
# instance and use it from there.
#
# Attention: This template will be removed in favor of the OpenTofu CI/CD component as soon as components
#            are available for self-managed instances.
#
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/OpenTofu.latest.gitlab-ci.yml

include:
  - template: OpenTofu/Base.latest.gitlab-ci.yml  # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/OpenTofu/Base.latest.gitlab-ci.yml

stages: [validate, build, deploy, cleanup]

fmt:
  extends: .opentofu:fmt

validate:
  extends: .opentofu:validate

plan:
  extends: .opentofu:plan

apply:
  extends: .opentofu:apply

cleanup:
  extends: .opentofu:destroy

https://kodekloud.com/blog/understanding-terraform-modules/