Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Opentofu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Components
Opentofu
Commits
a6ebed2f
Unverified
Commit
a6ebed2f
authored
Jan 23, 2024
by
Timo Furrer
Browse files
Options
Downloads
Patches
Plain Diff
Add opinionated template for validate, plan and apply
parent
ee7d007d
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab/README.md
+15
-4
15 additions, 4 deletions
.gitlab/README.md
README.md
+15
-4
15 additions, 4 deletions
README.md
templates/validate-plan-apply.yml
+89
-0
89 additions, 0 deletions
templates/validate-plan-apply.yml
with
119 additions
and
8 deletions
.gitlab/README.md
+
15
−
4
View file @
a6ebed2f
...
@@ -35,7 +35,7 @@ include:
...
@@ -35,7 +35,7 @@ include:
version
:
<VERSION>
version
:
<VERSION>
opentofu_version
:
<OPENTOFU_VERSION>
opentofu_version
:
<OPENTOFU_VERSION>
stages
:
[
validate
,
test
,
build
,
deploy
,
cleanup
]
stages
:
[
validate
,
build
,
deploy
,
cleanup
]
```
```
A concrete example may look like this:
A concrete example may look like this:
...
@@ -51,7 +51,7 @@ include:
...
@@ -51,7 +51,7 @@ include:
version
:
latest
version
:
latest
opentofu_version
:
1.6.0
opentofu_version
:
1.6.0
stages
:
[
validate
,
test
,
build
,
deploy
,
cleanup
]
stages
:
[
validate
,
build
,
deploy
,
cleanup
]
---
---
...
@@ -65,10 +65,21 @@ include:
...
@@ -65,10 +65,21 @@ include:
version
:
0.0.0-alpha1
version
:
0.0.0-alpha1
opentofu_version
:
1.6.0
opentofu_version
:
1.6.0
stages
:
[
validate
,
test
,
build
,
deploy
,
cleanup
]
stages
:
[
validate
,
build
,
deploy
,
cleanup
]
```
```
Instead of including the
`full-pipeline`
, it's also possible to include individual jobs
### Opinionated Templates
This component repository also provides some templates that may often be used,
for example one that only runs validation (
`fmt`
and
`validate`
), plan and an apply,
but no destructive actions.
-
[
`validate-plan-apply`
](
templates/validate-plan-apply.yml
)
### Job Templates
Instead of including the
`full-pipeline`
or another opinionated tempalte,
it's also possible to include individual jobs
and compose your own pipeline, for example, to just run the
`fmt`
job you can do:
and compose your own pipeline, for example, to just run the
`fmt`
job you can do:
```
yaml
```
yaml
...
...
This diff is collapsed.
Click to expand it.
README.md
+
15
−
4
View file @
a6ebed2f
...
@@ -37,7 +37,7 @@ include:
...
@@ -37,7 +37,7 @@ include:
version
:
<VERSION>
version
:
<VERSION>
opentofu_version
:
<OPENTOFU_VERSION>
opentofu_version
:
<OPENTOFU_VERSION>
stages
:
[
validate
,
test
,
build
,
deploy
,
cleanup
]
stages
:
[
validate
,
build
,
deploy
,
cleanup
]
```
```
A concrete example may look like this:
A concrete example may look like this:
...
@@ -53,7 +53,7 @@ include:
...
@@ -53,7 +53,7 @@ include:
version
:
latest
version
:
latest
opentofu_version
:
1.6.0
opentofu_version
:
1.6.0
stages
:
[
validate
,
test
,
build
,
deploy
,
cleanup
]
stages
:
[
validate
,
build
,
deploy
,
cleanup
]
---
---
...
@@ -67,10 +67,21 @@ include:
...
@@ -67,10 +67,21 @@ include:
version
:
0.0.0-alpha1
version
:
0.0.0-alpha1
opentofu_version
:
1.6.0
opentofu_version
:
1.6.0
stages
:
[
validate
,
test
,
build
,
deploy
,
cleanup
]
stages
:
[
validate
,
build
,
deploy
,
cleanup
]
```
```
Instead of including the
`full-pipeline`
, it's also possible to include individual jobs
### Opinionated Templates
This component repository also provides some templates that may often be used,
for example one that only runs validation (
`fmt`
and
`validate`
), plan and an apply,
but no destructive actions.
-
[
`validate-plan-apply`
](
templates/validate-plan-apply.yml
)
### Job Templates
Instead of including the
`full-pipeline`
or another opinionated tempalte,
it's also possible to include individual jobs
and compose your own pipeline, for example, to just run the
`fmt`
job you can do:
and compose your own pipeline, for example, to just run the
`fmt`
job you can do:
```
yaml
```
yaml
...
...
This diff is collapsed.
Click to expand it.
templates/validate-plan-apply.yml
0 → 100644
+
89
−
0
View file @
a6ebed2f
spec
:
inputs
:
# Stages
stage_validate
:
default
:
'
validate'
description
:
'
Defines
the
validate
stage.
This
stage
includes
the
`fmt`
and
`validate`
jobs.'
stage_build
:
default
:
'
build'
description
:
'
Defines
the
build
stage.
This
stage
includes
the
`plan`
job.'
stage_deploy
:
default
:
'
deploy'
description
:
'
Defines
the
deploy
stage.
This
stage
includes
the
`apply`
job.'
# Versions
# This version is only required, because we cannot access the context of the component,
# see https://gitlab.com/gitlab-org/gitlab/-/issues/438275
version
:
default
:
'
latest'
description
:
'
Version
of
this
component.
Has
to
be
the
same
as
the
one
in
the
component
include
entry.'
opentofu_version
:
default
:
'
1.6.0'
options
:
-
'
$OPENTOFU_VERSION'
-
'
1.6.0'
-
'
1.6.0-rc1'
description
:
'
OpenTofu
version
that
should
be
used.'
# Images
image_registry_base
:
default
:
'
$CI_REGISTRY/components/opentofu'
# FIXME: not yet possible because of https://gitlab.com/gitlab-org/gitlab/-/issues/438722
# gitlab_opentofu_image:
# # FIXME: This should reference the component tag that is used.
# # Currently, blocked by https://gitlab.com/gitlab-org/gitlab/-/issues/438275
# # default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.opentofu_version ]]'
# default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
# description: 'Tag of the gitlab-opentofu image.'
# Configuration
root_dir
:
default
:
${CI_PROJECT_DIR}
description
:
'
Root
directory
for
the
OpenTofu
project.'
state_name
:
default
:
default
description
:
'
Remote
OpenTofu
state
name.'
auto_apply
:
default
:
'
false'
description
:
'
Whether
the
apply
job
is
manual
or
automatically
run.'
---
include
:
-
local
:
'
/templates/fmt.yml'
inputs
:
as
:
'
fmt'
stage
:
$[[ inputs.stage_validate ]]
version
:
$[[ inputs.version ]]
opentofu_version
:
$[[ inputs.opentofu_version ]]
image_registry_base
:
$[[ inputs.image_registry_base ]]
root_dir
:
$[[ inputs.root_dir ]]
-
local
:
'
/templates/validate.yml'
inputs
:
as
:
'
validate'
stage
:
$[[ inputs.stage_validate ]]
version
:
$[[ inputs.version ]]
opentofu_version
:
$[[ inputs.opentofu_version ]]
image_registry_base
:
$[[ inputs.image_registry_base ]]
root_dir
:
$[[ inputs.root_dir ]]
state_name
:
$[[ inputs.state_name ]]
-
local
:
'
/templates/plan.yml'
inputs
:
as
:
'
plan'
stage
:
$[[ inputs.stage_build ]]
version
:
$[[ inputs.version ]]
opentofu_version
:
$[[ inputs.opentofu_version ]]
image_registry_base
:
$[[ inputs.image_registry_base ]]
root_dir
:
$[[ inputs.root_dir ]]
state_name
:
$[[ inputs.state_name ]]
-
local
:
'
/templates/apply.yml'
inputs
:
as
:
'
apply'
stage
:
$[[ inputs.stage_deploy ]]
version
:
$[[ inputs.version ]]
opentofu_version
:
$[[ inputs.opentofu_version ]]
image_registry_base
:
$[[ inputs.image_registry_base ]]
root_dir
:
$[[ inputs.root_dir ]]
state_name
:
$[[ inputs.state_name ]]
auto_apply
:
$[[ inputs.auto_apply ]]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment