IBM-Cloud / terraform-provider-ibm

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

Cannot provision IBP using ibm_resource_instance #1186

Closed rolivieri closed 4 years ago

rolivieri commented 4 years ago

Hello, our environment is IBM Cloud Schematics, Terraform version v0.11.14.

Using Schematics/Terraform, we can successfully provision services on the IBM Cloud such as LogDNA, Sysdig, IBM Cloud Object Storage, and others... however, attempting to provision an instance of IBM Blockchain Platform always fails with the following error:

2020/03/12 22:26:54 Terraform apply | ibm_resource_instance.mos-ibp: Creating...
 2020/03/12 22:26:54 Terraform apply |   crn:                     "" => "<computed>"
 2020/03/12 22:26:54 Terraform apply |   guid:                    "" => "<computed>"
 2020/03/12 22:26:54 Terraform apply |   location:                "" => "us-south"
 2020/03/12 22:26:54 Terraform apply |   name:                    "" => "IBP-MOS"
 2020/03/12 22:26:54 Terraform apply |   plan:                    "" => "standard"
 2020/03/12 22:26:54 Terraform apply |   resource_controller_url: "" => "<computed>"
 2020/03/12 22:26:54 Terraform apply |   resource_crn:            "" => "<computed>"
 2020/03/12 22:26:54 Terraform apply |   resource_group_id:       "" => "b224fe972aab45daa787ac21bf86cd2a"
 2020/03/12 22:26:54 Terraform apply |   resource_group_name:     "" => "<computed>"
 2020/03/12 22:26:54 Terraform apply |   resource_name:           "" => "<computed>"
 2020/03/12 22:26:54 Terraform apply |   resource_status:         "" => "<computed>"
 2020/03/12 22:26:54 Terraform apply |   service:                 "" => "blockchain"
 2020/03/12 22:26:54 Terraform apply |   status:                  "" => "<computed>"
 2020/03/12 22:26:54 Terraform apply |   tags.#:                  "" => "<computed>"
 2020/03/12 22:26:55 Terraform apply | 
 2020/03/12 22:26:55 Terraform apply | Error: Error applying plan:
 2020/03/12 22:26:55 Terraform apply | 
 2020/03/12 22:26:55 Terraform apply | 1 error occurred:
 2020/03/12 22:26:55 Terraform apply |  * ibm_resource_instance.mos-ibp: 1 error occurred:
 2020/03/12 22:26:55 Terraform apply |  * ibm_resource_instance.mos-ibp: Cannot create instance of resource blockchain
 2020/03/12 22:26:55 Terraform apply | Use 'ibm_service_instance' if the resource is a Cloud Foundry service

Here's the block of code from our terraform script:

resource "ibm_resource_instance" "mos-ibp" {
  name              = "IBP-MOS"
  service           = "blockchain"
  plan              = "standard"
  location          = "${var.ibm_region}"
  resource_group_id = "${data.ibm_resource_group.mos_rg.id}"
}

And looking at the source code for terraform-provider-ibm, we can see that this is the line where it fails:

https://github.com/IBM-Cloud/terraform-provider-ibm/blob/master/ibm/resource_ibm_resource_instance.go#L180

IBM Blockchain Platform (v2) is not a Cloud Foundry service; therefore using ibm_service_instance is not the solution. The error message is not quite useful so not sure what is wrong. Looking at the terraform-provider-ibm source code, it looks like there could be some metadata missing on the IBM Blockchain Platform service definition?

Could you please advice? Thanks.

albee-jhoney commented 4 years ago

Refer to the docs for resource_instance (https://cloud.ibm.com/docs/terraform?topic=terraform-resource-mgmt-resources#resource-instance).

You must pass the correct parameters json data, to successfully provision the Blockchain resource, it cannot be blank.. We have not yet tested the resource_instance for IBM Blockchain. Pls connect with the blockchain service team to get a sample request payload / parameters, to provision the Blockchain resource instance on IBM Cloud.

tnakajo commented 4 years ago

@hkantare, I will wait for an update as the terraform provider issue in here.

tnakajo commented 4 years ago

Let me know if you need to engage with the blockchain service team to discuss.

hkantare commented 4 years ago

We identified the issue ..We need to make changes in reading Metadata to check if the service can be provisioned using service-instance or resource-instance. It will be available part of next release...(early next release)

rolivieri commented 4 years ago

@hkantare Thanks for the update. When will this next release be available? Can you provide an ETA?

tnakajo commented 4 years ago

@hkantare Thank you. We'll wait for your update about the ETA for the next release.

hkantare commented 4 years ago

ETA will be mostly on 26th or 27th March..We will update the issue once we fix Terraform and update Schematics

rolivieri commented 4 years ago

@hkantare Hello, just following up. Is the issue resolved or do you guys have a new ETA that you could share with us?

hkantare commented 4 years ago

The issue is resolved..Can you please try with latest relelases v1.2.6 or v1.2.5

rolivieri commented 4 years ago

@hkantare It is working! Thanks for your help!

uhaller commented 4 years ago

hi, I'm trying to create an IBM Blockchain instance via following command:

ibmcloud resource service-instance-create blockchain-test-uh blockchain standard eu-de -g default

With this command I'm getting following output:

Creating service instance blockchain-test-uh in resource group default of account IBM as uhaller@de.ibm.com... FAILED Error parsing JSON: json: cannot unmarshal array into Go struct field ServiceResourceMetadata.service of type resource.ServiceParameters

Can you please advice whether this behavior is related to the closed issue or whether I have to open a new issue. Thanks in advance.

hkantare commented 4 years ago

@uhaller Are you using Terraform provider or IBM cloud cli to provision resource

uhaller commented 4 years ago

When running the ibmcloud command I'm assuming this is the IBM cloud cli. I'm not sure whether the Terraform provider is used under the hood to provision resources.

hkantare commented 4 years ago

Yes its an issue from ibmcloud cli it doesn't use the Terraform provider ..From our terraform provider we can provision the resource successfully

resource "ibm_resource_instance" "mos-ibp" {
  name              = "IBP-MOS"
  service           = "blockchain"
  plan              = "standard"
  location          = "${var.ibm_region}"
  resource_group_id = "${data.ibm_resource_group.mos_rg.id}"
}

You can open cloud support ticket or https://github.ibm.com/Bluemix/bluemix-cli/issues open an issue here..

uhaller commented 4 years ago

ok, thanks.

y0zg commented 4 years ago

Hi @rolivieri ,

After IBP resource creation how do you link it with IKS cluster? I see this is a manual step in IBM cloud console