►
From YouTube: Terraform with GitLab
Description
Documentation: https://docs.gitlab.com/ee/user/infrastructure/
Main epic: https://gitlab.com/groups/gitlab-org/-/epics/1925
A
My
name
is
victor
knight,
I'm
one
of
the
product
managers
at
gitlab
and
in
this
video
I
would
like
to
give
you
a
short
walkthrough
of
gitlab
stratform
integrations
as
most
gitlab
features.
We
have
these
integrations
documented
as
well,
and
I
will
basically
show
everything
that's
currently
in
the
documentation,
but
it
might
still
be
nice
to
have
a
single
project
to
get
everything
there.
So
what
do?
What
does
gitlab
offer
today
to
help
you
with
infrastructure
schools?
A
First
of
all,
we
have
something
we
call
the
gitlab
manager
from
state.
This
is
a
storage
back-end
for
your
terraform
workflows
and
setups.
I
will
show
you
how
it
works.
Then.
We
have
mergerquest
integrations
specifically
designed
for
terraform
to
have,
with
collaboration
related
to
infrastructure
projects,
and
we
maintain
the
gitlab
track
from
provider
that
I'm
going
to
use.
In
this
example,
let's
get
started
first,
I'm
going
to
create
a
new
project
so
totally
blank
one.
So
target
walkthrough
seems
like
a
good.
A
Project
name
here
I
can
make
it
private
or
probably
doesn't
matter.
I
will
keep
it
private
just
for
the
demo
and
make
it
public
later
on.
If
you
want
to
check
out
the
source
code,
let's
get
started
immediately,
I
will
add
ci
cd
and
it
might
be
tempting
to
use
the
apply,
template
and
look
for
terraform,
but
actually
I
recommend
not
to
do
this.
Instead
go
back
to
our
documentation
and
copy.
A
This
definitely
provide
there.
The
reason
why
I
recommend
this
approach
instead
of
the
of
the
template
here,
is
that
this
documentation
is
the
latest
start
from
template
that
shipped
with
gitlab
and
it's
not
available
in
the
drop
down
yet
so
this
is
the
approach
that
you
can
that
provides
the
most
benefit
and
uses
these
relative
recent
features
of
gitlab.
A
A
Clone
everything
here
and
then
we
can
open
it
transform
walkthrough
project.
As
you
can
see,
we
have
the
cima
file
as
before.
Okay
now,
let
me
add
a
readme
here
to
see
what
we
want
to
do.
Actually,
what
I
want
to
do
is
pretty
simple.
I
have
to
say
it's
something
like
this
one.
A
What
we
will
do
and
then
I
want
to
change
so
what
I'm
going
to
do
is
we
are
done
with
the
project
we
added
the
ci,
then
I'm
going
to
add
some
telephone
code
that
will
run
through
the
ci
as
we
want
it
to
be
automated
and
it
will
set
an
environment
variable
medium
git
lab
using
the
gitlab
trafform
provider,
and
then
I'm
going
to
change
the
invert
variable
in
the
separate
branch
to
see
how
collaborations
bursts
in
merge
requests.
So
that's
that's
the
plan
for
this
video.
A
Okay.
I
bet
it's
with
me.
A
A
I'm
going
to
copy
and
paste,
I
will
be
wrote
it
separately.
So,
let's
go
through
this
quickly.
I
define
a
backend
which
is
an
hd
back-end.
This
is
the
definition
needed
for
the
git.
Let
me
start
from
state
all
the
environment
variables
required
for
configuring.
This
back-end
will
be
done
by
ci
variables
and
environment
drivers
in
the
ci
job
and
the
special
civil
that
we
use
here.
A
So
that's
it
and
then
what
I'm
going
to
do
is
just
reset
greetings
world.
We
just
had
a
an
environment
variable
in
this
project.
That's
that's
what
we
want
to
do
today.
Okay,
so
everything
is
set
up.
A
few
more
things
here
is
that
there
is
one
input
variable
that
I
have
to
provide
to
terraform
in
order
to
be
able
to
access
gitlab
using
the
gitlab
provider
itself.
A
So
here
we
go
and
I
think
I'm
we
are
ready
to
go.
So,
let's,
oh,
no,
not
yet
there's
one
more
card
that
I
didn't
spoke
about,
which
is
if
we
go
back
to
the
vs
code,
you
can
see
that
actually
my
code
is
telephone
called,
is
in
a
terraform
subdirectory.
So
somehow
we
have
to
tell
to
ci
job
to
use,
to
look
for
truck
from
files
in
the
telephone
directory
and
the
ci
seemingly
has
no
setups
recording
nothing.
That
would
speak
about
that.
A
So
what
we
have
to
do
here
is,
I
opened
already
the
telephone
template
that
we
are
using,
which
is
these
are
templates
that
ship
with
gitlab.
This
is
the
one
that's
included
if
you
use
the
dropdown,
and
this
is
the
one
that
we
are
actually
using
and
it
references
another
template.
You
can
see
here
the
terraform
slash
base
latest
gitlab
ciemo.
A
A
Here
we
go,
and
now
we
are
good
to
commit
these
changes
added
initial,
something
like
that
for
rocks.
A
Okay
and
let's
push
these
changes
to
gitlab
in
gitlab.
If
we
check
out
the
csd
partner,
you
can
see
that
it's
running
right
now.
It
will
clearly
take
quite
some
time
to
run
over
the
steps
we'll
get
back
to
this
soon,
but
in
the
meantime,
let's
get
started
with
our
second
topic,
that
is
to
create
an
environment
where
we
can
collaborate.
So
I
want
to
change
this
environment
variable
in
a
different
branch,
as
here
the
default
bench
is
still
called
master.
Let's
call
our
new
branch
apprentice.
A
A
A
Let's
see
there,
we
are
yes,
it
failed
because
there's
no
value
for
required
variable
the
gitlab
access
token,
if
you
remember
the
gitlab
access
token
is
required
in
order
to
access
the
gitlab
api
through
through
that
traffic
provider
and
we
set
it
as
an
environment
variable.
So
why
is
it
feeling?
The
reason
is
actually
very
simple.
A
If
I
go
to
settings
cicd
and
open
the
variable
section,
you
can
see
that
it
is
a
protected
variable
and
protected.
Variable
means
that
it's
only
excess,
accessible
in
protected
branches.
Now
master
is
a
protected
branch,
but
apprentice
is
not
so
I
can
do
two
things.
I
either
remove
the
protectiveness
of
this
arrival
or
I
will
make
apprentice
a
protected
branch
as
well.
A
This
is
fully
green.
Now
great,
let's
restart
the
build
here
and
in
the
meantime,
I'm
going
to
show
you
what
happened
that
actually,
where
is
the
state
file?
You
can
see
under
operations
menu?
There
is
a
traffic
sub
menu,
so
you
can
go
just
there
and
we
have.
A
It
says
that
we
have
a
deport
state
that
was
updated
40
54
seconds
ago,
and
I
have
a
few
actions
around
that
I
can
download
the
state
file
only.
We
are
project
maintainers
as
I
am
because
I'm
the
owner,
I
can
lock
it
or
can
I
can
remove
the
state
file
with
all
of
its
versions,
what's
important,
that
this
star
from
state
backend
provides
versioning
and
encryption
out
of
the
box,
including
locking
and
everything
like
that.
A
So
it's
a
pretty
cool
hd
backhander,
okay,
but
this
name
might
be
even
a
warning
for
us,
because
what
we
see
here
is
that
the
default
state-
this
was
the
same
state
that
would
be
written
by
the
apprentice
branch
as
well.
Something
we
definitely
don't
want
to
do
one
option,
for
that
would
be
to
change
the
git
fcimo
and
change
the
transform
state
name
here
to
ci
committer
or
something
like
that
now
I'm
go
want
to
do
that,
but
this
is
just
good
to
know.
A
A
A
So
there
are
many
things
I
could
do
here.
If
I
would
have
a
specific
development
environment
and
a
production
environment
in
the
trafform
code,
I
can
specify
the
environment
scope
as
well.
This
is
the
documentation
for
the
gitlab
traffic
provider.
A
A
So
if
you
go
back
to
the
merge
request
and
the
merge,
these
changes
emerge
pipeline
kicked
off
and
last
up
of
that
will
be
again
deploy
step
and
this
this
deploy
step
will
be
manual
as
it
was
on
master
branch
menu
as
well,
but
once
we
do
that
the
value
will
have
to
change.