IBM-Cloud / terraform-provider-ibm

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

Private/direct COS endpoint settings conflicts with IBM Cloud docs, VPE options, and COS config endpoint #4844

Closed cjschaef closed 9 months ago

cjschaef commented 11 months ago

Community Note

Terraform CLI and Terraform IBM Provider Version

TF: 1.3.7 (I believe) IBM TF: 1.56.0

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please share a link to the ZIP file.

Debug Output

COS Config endpoint generated only allows for private override, no direct endpoint. https://github.com/IBM-Cloud/terraform-provider-ibm/blob/0b2c15e4362b70dc1c4adf3996cd20447edae6c8/ibm/service/cos/resource_ibm_cos_bucket.go#L1149-L1162

However, VPC VPE's only allow the use of COS direct endpoints in an isolated environment, making the use of Private invalid.

time="2023-09-22T17:17:05Z" level=error msg="  with module.image.ibm_cos_bucket.images,"
time="2023-09-22T17:17:05Z" level=error msg="  on image/main.tf line 5, in resource \"ibm_cos_bucket\" \"images\":"
time="2023-09-22T17:17:05Z" level=error msg="   5: resource \"ibm_cos_bucket\" \"images\" {"
time="2023-09-22T17:17:05Z" level=error
time="2023-09-22T17:17:05Z" level=error msg="failed to fetch Cluster: failed to generate asset \"Cluster\": failure applying terraform for \"network\" stage: failed to create cluster: failed to apply Terraform: exit status 1\n\nError: RequestError: send request failed\ncaused by: Put \"https://s3.private.us-east.cloud-object-storage.appdomain.cloud/us-east-disconnect-14-p8xb7-vsi-image\": dial tcp 10.1.129.94:443: i/o timeout\n\n  with module.image.ibm_cos_bucket.images,\n  on image/main.tf line 5, in resource \"ibm_cos_bucket\" \"images\":\n   5: resource \"ibm_cos_bucket\" \"images\" {\n\n"

Panic Output

Expected Behavior

Creation of COS resources (buckets/objects)

Actual Behavior

Failure, wrong COS endpoint used (for example, COS Config is only either public or private, no direct gets automatically generated).

Steps to Reproduce

  1. Create COS resources using private or direct endpoint override

Important Factoids

References

cjschaef commented 11 months ago

Here's what I had to do, in order to get the direct endpoint for COS Config to be used when I was trying to create a new COS Bucket https://github.com/cjschaef/terraform-provider-ibm/blob/f72b2cb6965c9f87726a2b93c8d7faf5a5ef1a65/ibm/service/cos/resource_ibm_cos_bucket.go#L1149-L1158

    sess, err := meta.(conns.ClientSession).CosConfigV1API()
    if err != nil {
        return err
    }
    if endpointType == "private" {
        sess.SetServiceURL("https://config.private.cloud-object-storage.cloud.ibm.com/v1")
    }
    if endpointType == "direct" {
        sess.SetServiceURL("https://config.direct.cloud-object-storage.cloud.ibm.com/v1")
    }
hkantare commented 11 months ago

@IBM-diksha Can you look into this

IBM-diksha commented 11 months ago

@cjschaef Thank you for reaching out I am looking into this one.

IBM-diksha commented 9 months ago

This issues has been fixed in the latest version - v1.60.0. Here is the PR : https://github.com/IBM-Cloud/terraform-provider-ibm/pull/4919

IBM-diksha commented 9 months ago

Closing the issue.