gomorpheus / terraform-provider-morpheus

Terraform Morpheus provider
MIT License
17 stars 21 forks source link

[BUG ?]morpheus_python_script_task doesn't accept repository_id #288

Closed jigeay closed 1 month ago

jigeay commented 1 month ago

Hello,

Using morpheus_python_script_task with the repository mode doesn't work with the real repository_id :

  code                = "configureMorpheusVmwareNetwork"
  labels              = ["scheduled", "terraform_managed","vmware"]
  source_type         = "repository"
  script_path         = "0-configureMorpheusVmwareNetworks.py"
  version_ref         = "main"
  repository_id       = morpheus_git_integration.python_config.id
  command_arguments   = "-vvv"
  additional_packages = "pyvmomi requests argparse pandas urllib3 morpheus-cypher"
  python_binary       = "/bin/python3"
}

2024-10-07 15_07_32-r-automation tf - morpheus-foundation  SSH_ pdeviac  - Visual Studio Code

2024-10-07 15_07_59-Automation _ Morpheus et 17 pages de plus - Travail – Microsoft​ Edge

I checked the id onto the UI, and it is correct : 2024-10-07 14_57_31-r-integrations tf - morpheus-foundation  SSH_ pdeviac  - Visual Studio Code

I made several tests and it seems to be working by substracting 6 (??) to the id.

martezr commented 1 month ago

The ID that needs to be referenced in the repository_id and not the id of the Morpheus integration. The repository_ids attribute is what should be used from the morpheus_git_integration resource instead of the id attribute. The specific repository id is accessed by providing the name of the repository as it appears in Morpheus, this can be found under Provisioning > Code > Repositories in the Morpheus UI.

Below is an example of how the repository_ids attribute would be used in this context.

resource "morpheus_python_script_task" "tfexample_python_local" {
  name                = "tfexample_python_local"
  code                = "configureMorpheusVmwareNetwork"
  labels              = ["scheduled", "terraform_managed","vmware"]
  source_type         = "repository"
  script_path         = "0-configureMorpheusVmwareNetworks.py"
  version_ref         = "main"
  repository_id       = morpheus_git_integration.python_config.repository_ids["REPOSITORY_NAME"]
  command_arguments   = "-vvv"
  additional_packages = "pyvmomi requests argparse pandas urllib3 morpheus-cypher"
  python_binary       = "/bin/python3"
}