rundeck / terraform-provider-rundeck

Terraform Rundeck provider
https://www.terraform.io/docs/providers/rundeck/
Mozilla Public License 2.0
52 stars 61 forks source link

Any way to setup SCM with module #76

Open cadams-entrata opened 2 years ago

cadams-entrata commented 2 years ago

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 commented 2 years ago

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 commented 1 year ago

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.