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

Expose the error message when Cloud Logs instance provisioning fails #5729

Open ocofaigh opened 1 month ago

ocofaigh commented 1 month ago

When Cloud Logs instance provisioning fails, it returns a generic message like this:

 2024/10/14 14:57:23 Terraform apply | ---
 2024/10/14 14:57:23 Terraform apply | id: terraform-446cc00a
 2024/10/14 14:57:23 Terraform apply | summary: '[ERROR] Error waiting for create resource instance
 2024/10/14 14:57:23 Terraform apply | (crn:v1:bluemix:public:logs:us-south:a/abac0df06b644a9cabc6e44f55b3880e:de2cb63b-6d18-4794-a5d4-4f1c10d40c0d::)
 2024/10/14 14:57:23 Terraform apply |   to be succeeded: [ERROR] The resource instance ''crn:v1:bluemix:public:logs:us-south:a/abac0df06b644a9cabc6e44f55b3880e:de2cb63b-6d18-4794-a5d4-4f1c10d40c0d::''
 2024/10/14 14:57:23 Terraform apply |   creation failed: <nil>'
 2024/10/14 14:57:23 Terraform apply | severity: error
 2024/10/14 14:57:23 Terraform apply | resource: ibm_resource_instance
 2024/10/14 14:57:23 Terraform apply | operation: create
 2024/10/14 14:57:23 Terraform apply | component:
 2024/10/14 14:57:23 Terraform apply |   name: github.com/IBM-Cloud/terraform-provider-ibm
 2024/10/14 14:57:23 Terraform apply |   version: 1.69.2
 2024/10/14 14:57:23 Terraform apply | ---

However, we do have the error message in RC's last_operation.description field but the TF provider resource_instance resource doesn't read it. Can the error be exposed in the provider output?

Community Note

Terraform CLI and Terraform IBM Provider Version

tf 1.9.2 provider 1.69.2

Affected Resource(s)

Terraform Configuration Files

https://github.com/terraform-ibm-modules/terraform-ibm-observability-instances/blob/main/modules/cloud_logs/main.tf

Debug Output

Panic Output

Expected Behavior

Expose the error in the log output

Actual Behavior

Generic error message returned with no information on why provisioning fails

Steps to Reproduce

  1. terraform apply

Important Factoids

References