IBM-Cloud / terraform-provider-ibm

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

ibm_is_image: Intermittent issue with image creation due to invalid IAM Token #4267

Open fshuva opened 1 year ago

fshuva commented 1 year ago

Community Note

Terraform CLI and Terraform IBM Provider Version

Terraform : v1.1.9 IBM Provider: v1.49.0

Affected Resource(s)

Terraform Configuration Files

terraform.zip

Debug Output

https://gist.github.com/fshuva/f3aa1f8c9ff6d93fa98331ec28c6e1cd

Expected Behavior

An image should have been created. Below is a debug log from a successful deployment:

2023/01/03 23:12:39 Terraform apply | random_string.random_suffix: Creating... 2023/01/03 23:12:39 Terraform apply | random_string.random_suffix: Creation complete after 0s [id=stkg] 2023/01/03 23:12:40 Terraform apply | ibm_is_volume.logDisk1: Creating... 2023/01/03 23:12:40 Terraform apply | ibm_is_volume.logDisk2: Creating... 2023/01/03 23:12:40 Terraform apply | ibm_is_image.vnf_custom_image: Creating... 2023/01/03 23:12:50 Terraform apply | ibm_is_volume.logDisk1: Still creating... [10s elapsed] 2023/01/03 23:12:50 Terraform apply | ibm_is_volume.logDisk2: Still creating... [10s elapsed] 2023/01/03 23:12:50 Terraform apply | ibm_is_image.vnf_custom_image: Still creating... [10s elapsed] 2023/01/03 23:12:59 Terraform apply | ibm_is_volume.logDisk1: Creation complete after 18s [id=r006-95ccde7e-2d81-4c8b-87c0-aa1d80e6f922] 2023/01/03 23:13:00 Terraform apply | ibm_is_volume.logDisk2: Still creating... [20s elapsed] 2023/01/03 23:13:00 Terraform apply | ibm_is_image.vnf_custom_image: Still creating... [20s elapsed] 2023/01/03 23:13:08 Terraform apply | ibm_is_volume.logDisk2: Creation complete after 27s [id=r006-68b98f05-d367-4f9d-98ba-ef831365f904] 2023/01/03 23:13:10 Terraform apply | ibm_is_image.vnf_custom_image: Still creating... [30s elapsed] 2023/01/03 23:13:17 Terraform apply | ibm_is_image.vnf_custom_image: Creation complete after 37s [id=r006-96592fde-7320-4483-a44c-dd0e83423c4b]

Actual Behavior

Deployment failed with error "The IAM token that was specified in the request has expired or is invalid. The request is not authorized to access the Cloud Object Storage resource."

This issue is intermittent. Sometimes the deployment will be successful with no errors.

Steps to Reproduce

  1. terraform apply
ujjwal-ibm commented 1 year ago

looking into it

AdamGoodison commented 1 year ago

Hi team @ujjwal-ibm

Customer updated:

Looks like the Schematics server is unable to pull the image sometimes and is timing out since when I run terraform the first time it error'd out at image pull with an error ""The IAM token that was specified in the request has expired or is invalid. The request is not authorized to access the Cloud Object Storage resource." and later tries (multiple attempts) were all successful.

Failure: complete after 0s [id=kwte] 2023/01/05 23:56:36 Terraform apply | ibm_is_image.vnf_custom_image: Creating... 2023/01/05 23:56:36 Terraform apply | ibm_is_volume.logDisk: Creating... 2023/01/05 23:56:46 Terraform apply | ibm_is_volume.logDisk: Still creating... [10s elapsed] 2023/01/05 23:56:51 Terraform apply | ibm_is_volume.logDisk: Creation complete after 15s [id=r014-a4b06223-c281-48c9-86c6-fe9b8f45d950] 2023/01/05 23:56:51 Terraform apply | 2023/01/05 23:56:51 Terraform apply | Error: [DEBUG] Image creation err The IAM token that was specified in the request has expired or is invalid. The request is not authorized to access the Cloud Object Storage resource. 2023/01/05 23:56:51 Terraform apply | { 2023/01/05 23:56:51 Terraform apply | "StatusCode": 403, 2023/01/05 23:56:51 Terraform apply | "Headers": { 2023/01/05 23:56:51 Terraform apply | "Cache-Control": [ 2023/01/05 23:56:51 Terraform apply | "max-age=0, no-cache, no-store, must-revalidate"

Success: 2023/01/06 00:31:40 Terraform apply | ibm_is_image.vnf_custom_image: Creating... 2023/01/06 00:31:50 Terraform apply | ibm_is_image.vnf_custom_image: Still creating... [10s elapsed] 2023/01/06 00:32:00 Terraform apply | ibm_is_image.vnf_custom_image: Still creating... [20s elapsed] 2023/01/06 00:32:10 Terraform apply | ibm_is_image.vnf_custom_image: Still creating... [30s elapsed] 2023/01/06 00:32:15 Terraform apply | ibm_is_image.vnf_custom_image: Creation complete after 36s [id=r014-1a3e028e-2462-473d-a76f-d23c6df9b104] 2023/01/06 00:32:15 Terraform apply | ibm_is_instance.fgt1: Creating... 2023/01/06 00:32:25 Terraform apply | ibm_is_instance.fgt1: Still creating... [10s elapsed] 2023/01/06 00:32:35 Terraform apply | ibm_is_instance.fgt1: Still creating... [20s elapsed] 2023/01/06 00:32:40 Terraform apply | ibm_is_instance.fgt1: Creation complete after 25s [id=0757_ef779f6c-c91f-42d3-8e73-89624c924f0a]

ChethanaHN1 commented 1 year ago

Team, Do we have any update on this please ?