IBM-Cloud / ansible-collection-ibm

https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs
Mozilla Public License 2.0
70 stars 73 forks source link

ibm_certificate_manager_import can't import certificates #67

Open grommir opened 3 years ago

grommir commented 3 years ago

I use part of the code from examples:

- name: Import a certificate on a certificate manager insatnce.
  hosts: localhost
  collections:
   - ibm.cloudcollection
  tasks:
    - name: Fetch the variables from var file
      include_vars:
        file: vars.yml

    - name: provision certificate manager resource instance
      ibm_resource_instance:
        name: "{{ service_name }}"
        location: "{{ location }}"
        service: "cloudcerts"
        plan: "free"
      register: resource_instance_output

    - name: Save certificate manager resource instance as fact
      set_fact:
        cacheable: True
        cms: "{{ resource_instance_output.resource }}"
      when: resource_instance_output.rc==0

    - name: provision cms import resource.
      ibm_certificate_manager_import:
        certificate_manager_instance_id: "{{ cms.id }}"
        name: "{{ import_name }}"
        data: 
          content: "{{ lookup('file', '/mnt/d/tmp/ansible/ca.crt') }}"
      register: cms_import_output
ansible-playbook create.yml

And error:

fatal: [localhost]: FAILED! => {"changed": false, "msg": "", "rc": 1, "resource": {"_name": "testimport", "_type": "ibm_certificate_manager_import", "target": "ibm_certificate_manager_import.testimport"}, "stderr": "
Error: Missing required argument

  on ibm_certificate_manager_import_testimport.tf line 1, in resource "ibm_certificate_manager_import" "testimport":
   1: resource ibm_certificate_manager_import "testimport" {

The argument "data" is required, but no definition was found.

Error: Unsupported block type

  on ibm_certificate_manager_import_testimport.tf line 4, in resource "ibm_certificate_manager_import" "testimport":
   4:   data {

Blocks of type "data" are not expected here. Did you mean to define argument
"data"? If so, use the equals sign to assign it a value.

", "stderr_lines": ["", "Error: Missing required argument", "", "  on ibm_certificate_manager_import_testimport.tf line 1, in resource "ibm_certificate_manager_import" "testimport":", "   1: resource ibm_certificate_manager_import "testimport" {", "", "The argument "data" is required, but no definition was found.", "", "", "Error: Unsupported block type", "", "  on ibm_certificate_manager_import_testimport.tf line 4, in resource "ibm_certificate_manager_import" "testimport":", "   4:   data {", "", "Blocks of type "data" are not expected here. Did you mean to define argument", ""data"? If so, use the equals sign to assign it a value.", ""], "stdout": "", "stdout_lines": []}

Code in ibm_certificate_manager_import_testimport.tf shows that "=" is missing after "data"

resource ibm_certificate_manager_import "testimport" {
  certificate_manager_instance_id = "crn:v1:bluemix:public:cloudcerts:us-south:a/blabla::"
  name = "test_import"
  data {
    content = "-----BEGIN CERTIFICATE-----blabla-----END CERTIFICATE-----"
}
}