This module deploy gitlab agent to gitlab projects or groups. Also have option to create project if not exist. Important thing on this module is agent_config variable, its map kind any, example gitlab agent config is down below.
Example config
agent_config = {
"ci_access" = {
"projects" = [
{
"id" : path/to/project, environments = ["exampleEnvironment1", "exampleEnvironment2"]
}
]
"groups" = [
{
"id" : path/to/group/subgroup, environments = ["exampleEnvironment1", "exampleEnvironment2"]
}
]
}
}
Name | Version |
---|---|
terraform | >= 1.0 |
gitlab | >= 16.0, < 18.0 |
helm | ~> 2.9 |
kubernetes | ~> 2.21 |
Basic usage of this module is as follows:
module "example" {
source = "<module-path>"
# Required variables
agent_name =
gitlab_agent_cluster_projects =
# Optional variables
agent_config = {}
agent_version = null
author_email = "[email protected]"
chart_version = "1.14.1"
commit_message = "feature: add/update agent config"
create_namespace = false
create_project = false
namespace = "gitlab-agent"
project_name = "k8s-agent"
project_namespace = ""
project_path = null
token_description = ""
}
Name | Type |
---|---|
gitlab_cluster_agent.this | resource |
gitlab_cluster_agent_token.this | resource |
gitlab_project.this | resource |
gitlab_repository_file.agent_config | resource |
helm_release.gitlab_agent | resource |
kubernetes_namespace.gitlab_agent | resource |
gitlab_group.namespace | data source |
gitlab_metadata.this | data source |
gitlab_project.this | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
agent_config | agent config to be used regarding: * https://docs.gitlab.com/ee/user/clusters/agent/gitops.html * https://docs.gitlab.com/ee/user/clusters/agent/ci_cd_workflow.html#authorize-the-agent-to-access-your-projects |
any |
{} |
no |
agent_name | agent name | string |
n/a | yes |
agent_version | specific agent version | string |
null |
no |
author_email | author email to be used for commit | string |
"[email protected]" |
no |
chart_version | agent chart version | string |
"1.14.1" |
no |
commit_message | use this commit message for agent config update | string |
"feature: add/update agent config" |
no |
create_namespace | option for create namespace | bool |
false |
no |
create_project | create a new agent managing project or use existing one | bool |
false |
no |
gitlab_agent_cluster_projects | n/a | map(object({ |
n/a | yes |
namespace | agent namespace | string |
"gitlab-agent" |
no |
project_name | agent managing project nice/visible name | string |
"k8s-agent" |
no |
project_namespace | agent managing project namespace, required when creating new project | string |
"" |
no |
project_path | agent managing project technical name (slug) | string |
null |
no |
token_description | gilab agent token description in managing project | string |
"" |
no |
No outputs.