Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to setup SCM with module #76

Open
cadams-entrata opened this issue Mar 11, 2022 · 2 comments
Open

Any way to setup SCM with module #76

cadams-entrata opened this issue Mar 11, 2022 · 2 comments

Comments

@cadams-entrata
Copy link

Hello,

Is there a way to configure SCM export and import settings from the Terraform module? I added the settings to the extra_config section of rundeck_project, but that did not work. I, also, could not find any documentation on another way to do it.

Thanks

@decento
Copy link

decento commented Mar 24, 2022

The scm configuration isn't available in this provider.
Here is how I ended up doing this with 'rd'

`
locals {
rundeck_environment = {
RD_URL = var.rundeck_url
RD_TOKEN = var.rundeck_token
RD_PROJECT = var.rundeck_project_name
RD_HTTP_TIMEOUT = "300"
}
scm_config = <<-EOT
{
"config": {
"url": "${var.rundeck_project_git_url}",
"fetchAutomatically": "true",
"pullAutomatically": "true",
"dir": "/home/rundeck/projects/${var.rundeck_project_name}/scm",
"filePattern": ".*.yaml",
"importUuidBehavior": "remove",
"useFilePattern": "true",
"strictHostKeyChecking": "no",
"sshPrivateKeyPath": "keys/gitlab",
"format": "yaml",
"branch": "${var.rundeck_project_git_branch}",
"pathTemplate": "$${job.group}$${job.name}.$${config.format}"
}
}
EOT
}

resource "local_file" "scm_config_file" {
content = local.scm_config
filename = "/tmp/${var.rundeck_project_name}-scm-config.json"
}

resource "null_resource" "scm_configure" {
triggers = {
always_run = timestamp()
}
depends_on = [ rundeck_project.ansible_rundeck_project , local_file.scm_config_file ]
provisioner "local-exec" {
environment = local.rundeck_environment
command = "rd projects scm setup -i import -t git-import -f ${local_file.scm_config_file.filename}"
on_failure = continue
}
}

resource "null_resource" "scm_import_all" {
triggers = {
always_run = timestamp()
}
depends_on = [ null_resource.scm_configure ]
provisioner "local-exec" {
environment = local.rundeck_environment
command = "rd projects scm perform -i import -a import-all --allitems"
on_failure = continue
}

}
`

@fdevans
Copy link
Contributor

fdevans commented Oct 23, 2023

We don't have the SCM setup included in the provider yet. As this is a community supported project we are open to Pull Requests that would add this as a option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants