jfrog / terraform-provider-artifactory

Terraform provider to manage JFrog Artifactory
https://jfrog.com/artifactory
Apache License 2.0
275 stars 106 forks source link

`remote_ansible_repository` returns 404 without 'Bypass HEAD requests' set #1121

Open dhrapson opened 18 hours ago

dhrapson commented 18 hours ago

Describe the bug

remote_ansible_repository creates remote repositories without 'Bypass HEAD requests' set & does not have an attribute to set that. The remote repositories always return 404 for uncached artifacts when this configuration is not True.

Repro steps With an ansible.cfg (copied from the Set Me Up):

[galaxy]
server_list = pt-galaxy-remote-ansible

[galaxy_server.galaxy-remote-ansible]
url=https://mycompany.jfrog.io/artifactory/api/ansible/galaxy-remote-ansible
token=my-token

Without that set:

ansible-galaxy collection install community.docker
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://mycompany.jfrog.io/artifactory/api/ansible/pt-galaxy-remote-ansible/api/v3/plugin/ansible/content/published/collections/artifacts/community-docker-4.0.0.tar.gz to /home/dhrapson/.ansible/tmp/ansible-local-3135yc58uda6/tmpsagg0to_/community-docker-4.0.0-6brcwmg3
ERROR! Failed to download collection tar from 'pt-ansible-virtual-thirdparty': HTTP Error 404: 

With it set:

ansible-galaxy collection install community.docker
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://mycompany.jfrog.io/artifactory/api/ansible/pt-galaxy-remote-ansible/api/v3/plugin/ansible/content/published/collections/artifacts/community-docker-4.0.0.tar.gz to /home/dhrapson/.ansible/tmp/ansible-local-3345j8w7poue/tmpijisaucb/community-docker-4.0.0-ozmm6dct
Installing 'community.docker:4.0.0' to '/home/dhrapson/.ansible/collections/ansible_collections/community/docker'
Downloading https://mycompany.jfrog.io/artifactory/api/ansible/pt-galaxy-remote-ansible/api/v3/plugin/ansible/content/published/collections/artifacts/community-library_inventory_filtering_v1-1.0.2.tar.gz to /home/dhrapson/.ansible/tmp/ansible-local-3345j8w7poue/tmpijisaucb/community-library_inventory_filtering_v1-1.0.2-e80tni4e
community.docker:4.0.0 was installed successfully
Installing 'community.library_inventory_filtering_v1:1.0.2' to '/home/dhrapson/.ansible/collections/ansible_collections/community/library_inventory_filtering_v1'
community.library_inventory_filtering_v1:1.0.2 was installed successfully

Requirements for and issue Terraform provider version 11.4.0 Terraform version 1.7.3

Expected behavior Either provide a bypass_head_requests attribute on the remote_ansible_repository resource so that it can be configured, or default this resource configuration to True

alexhung commented 11 hours ago

@dhrapson The attribute bypass_head_requests should be available for artifactory_remote_ansible_repository resource. Using the utility tfschema, this is the attribute list:

alexh@alexh-mac terraform-provider-artifactory % tfschema resource show artifactory_remote_ansible_repository
+---------------------------------------+-------------+----------+----------+----------+-----------+
| ATTRIBUTE                             | TYPE        | REQUIRED | OPTIONAL | COMPUTED | SENSITIVE |
+---------------------------------------+-------------+----------+----------+----------+-----------+
| allow_any_host_auth                   | bool        | false    | true     | false    | false     |
| archive_browsing_enabled              | bool        | false    | true     | false    | false     |
| assumed_offline_period_secs           | number      | false    | true     | false    | false     |
| blacked_out                           | bool        | false    | true     | false    | false     |
| block_mismatching_mime_types          | bool        | false    | true     | false    | false     |
| bypass_head_requests                  | bool        | false    | true     | false    | false     |
| cdn_redirect                          | bool        | false    | true     | false    | false     |
| client_tls_certificate                | string      | false    | true     | true     | false     |
| description                           | string      | false    | true     | false    | false     |
| disable_proxy                         | bool        | false    | true     | false    | false     |
| disable_url_normalization             | bool        | false    | true     | false    | false     |
| download_direct                       | bool        | false    | true     | false    | false     |
| enable_cookie_management              | bool        | false    | true     | false    | false     |
| excludes_pattern                      | string      | false    | true     | false    | false     |
| hard_fail                             | bool        | false    | true     | false    | false     |
| id                                    | string      | false    | true     | true     | false     |
| includes_pattern                      | string      | false    | true     | false    | false     |
| key                                   | string      | true     | false    | false    | false     |
| list_remote_folder_items              | bool        | false    | true     | false    | false     |
| local_address                         | string      | false    | true     | false    | false     |
| metadata_retrieval_timeout_secs       | number      | false    | true     | false    | false     |
| mismatching_mime_types_override_list  | string      | false    | true     | false    | false     |
| missed_cache_period_seconds           | number      | false    | true     | false    | false     |
| notes                                 | string      | false    | true     | false    | false     |
| offline                               | bool        | false    | true     | false    | false     |
| package_type                          | string      | false    | false    | true     | false     |
| password                              | string      | false    | true     | false    | true      |
| priority_resolution                   | bool        | false    | true     | false    | false     |
| project_environments                  | set(string) | false    | true     | true     | false     |
| project_key                           | string      | false    | true     | false    | false     |
| property_sets                         | set(string) | false    | true     | false    | false     |
| proxy                                 | string      | false    | true     | false    | false     |
| query_params                          | string      | false    | true     | false    | false     |
| remote_repo_layout_ref                | string      | false    | true     | false    | false     |
| repo_layout_ref                       | string      | false    | true     | false    | false     |
| retrieval_cache_period_seconds        | number      | false    | true     | false    | false     |
| share_configuration                   | bool        | false    | true     | true     | false     |
| socket_timeout_millis                 | number      | false    | true     | false    | false     |
| store_artifacts_locally               | bool        | false    | true     | false    | false     |
| synchronize_properties                | bool        | false    | true     | false    | false     |
| unused_artifacts_cleanup_period_hours | number      | false    | true     | false    | false     |
| url                                   | string      | false    | true     | false    | false     |
| username                              | string      | false    | true     | false    | false     |
| xray_index                            | bool        | false    | true     | false    | false     |
+---------------------------------------+-------------+----------+----------+----------+-----------+

block_type: content_synchronisation, nesting: NestingList, min_items: 0, max_items: 1
+---------------------------------+------+----------+----------+----------+-----------+
| ATTRIBUTE                       | TYPE | REQUIRED | OPTIONAL | COMPUTED | SENSITIVE |
+---------------------------------+------+----------+----------+----------+-----------+
| enabled                         | bool | false    | true     | false    | false     |
| properties_enabled              | bool | false    | true     | false    | false     |
| source_origin_absence_detection | bool | false    | true     | false    | false     |
| statistics_enabled              | bool | false    | true     | false    | false     |
+---------------------------------+------+----------+----------+----------+-----------+