Skip to content
Snippets Groups Projects
Unverified Commit a944f33e authored by Andrew Newdigate's avatar Andrew Newdigate
Browse files

fix: fix documentation, broken script

Fix publish script for Terraform Module publish
parent 8fa2a1b5
No related branches found
No related tags found
No related merge requests found
Pipeline #23704154 passed
Loading
Loading
@@ -8,10 +8,10 @@ include:
# see https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/terraform-module-publish.md
- project: 'gitlab-com/gl-infra/common-ci-tasks'
ref: v2.45.0 # renovate:managed
file: terraform-module-publish.md
file: terraform-module-publish.yml
inputs:
module_name:
module_system:
module_name: # Defaults to project name
module_system: # aws,google,etc
```
 
## Excluding files from the Terraform Module
Loading
Loading
@@ -22,3 +22,15 @@ This will reduce the size of the module,
improving performance throughout the development and provisioning cycle.
 
Dot files, including `.git`, will also be excluded by default.
### Example `.tfmoduleignore`
This snippet demonstrates the format of `.tfmoduleignore`:
```console
$ cat .tfmoduleignore
CODEOWNERS
*.md
renovate.json
scripts/**
```
Loading
Loading
@@ -29,7 +29,7 @@ spec:
---
 
publish-terraform-module:
image: curlimages/curl:latest
image: registry.gitlab.com/gitlab-com/gl-infra/common-ci-tasks-images/terraform-module-publish:latest
stage: release
variables:
TERRAFORM_MODULE_DIR: $[[ inputs.module_dir | expand_vars ]]
Loading
Loading
@@ -40,7 +40,7 @@ publish-terraform-module:
- |
# Sanitize version, remove `^v`
TERRAFORM_MODULE_VERSION=${TERRAFORM_MODULE_VERSION#v}
TARBALL_FILE=${TERRAFORM_MODULE_NAME}-${TERRAFORM_MODULE_SYSTEM}-${TERRAFORM_MODULE_VERSION}.tgz
TARBALL_FILE=$(mktemp).tgz
 
if [[ -f .tfmoduleignore ]]; then
ignore_args="--exclude-from=.tfmoduleignore"
Loading
Loading
@@ -52,8 +52,9 @@ publish-terraform-module:
- |
tar -cvzf "${TARBALL_FILE}" \
-C "${TERRAFORM_MODULE_DIR}" \
--exclude='*/\.*'
${ignore_args}
--exclude='*/\.*' \
--exclude-vcs \
${ignore_args} \
.
 
# Upload
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment