Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot omit field "bucket" for resource alicloud_oss_bucket #7761

Open
zcxsythenew opened this issue Oct 21, 2024 · 0 comments
Open

Cannot omit field "bucket" for resource alicloud_oss_bucket #7761

zcxsythenew opened this issue Oct 21, 2024 · 0 comments

Comments

@zcxsythenew
Copy link

The document of alicloud_oss_bucket says, the field "bucket" is "optional", and if it is "omitted, Terraform will assign a random and unique name."

However, when I really omitted the field and applied the following configuration:

terraform {
  required_providers {
    alicloud = {
        source = "aliyun/alicloud"
        version = "1.231.0"
    }
  }
}

provider "alicloud" {
  region = "cn-hangzhou"
  access_key = "x"
  secret_key = "x"
}

resource "alicloud_oss_bucket" "test_ci" {
  
}

I got the following error:

z@U-HW2FKVC9-1903 empty % tofu apply

OpenTofu used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

OpenTofu will perform the following actions:

  # alicloud_oss_bucket.test_ci will be created
  + resource "alicloud_oss_bucket" "test_ci" {
      + acl                                      = (known after apply)
      + bucket                                   = "tf-oss-bucket-20241021015616642900000001"
      + creation_date                            = (known after apply)
      + extranet_endpoint                        = (known after apply)
      + force_destroy                            = false
      + id                                       = (known after apply)
      + intranet_endpoint                        = (known after apply)
      + lifecycle_rule_allow_same_action_overlap = false
      + location                                 = (known after apply)
      + owner                                    = (known after apply)
      + redundancy_type                          = "LRS"
      + resource_group_id                        = (known after apply)
      + storage_class                            = "Standard"

      + access_monitor (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  OpenTofu will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for alicloud_oss_bucket.test_ci to include new values learned so far during apply, provider
│ "registry.opentofu.org/aliyun/alicloud" produced an invalid new value for .bucket: was cty.StringVal("tf-oss-bucket-20241021015616642900000001"),
│ but now cty.StringVal("tf-oss-bucket-20241021015618490200000001").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Therefore, either the provider has a bug when the field "bucket" is omitted, or the field "bucket" should be designed to be required.

Possible solution:

  • If we agree that the field "bucket" should continue to be optional, then maybe the value of this field should remain "(known after apply)" during plan, and should not be set until applying.
  • If we agree that the field "bucket" should be required, then the document and the resource schema should be modified.
zcxsythenew added a commit to zcxsythenew/terraform-provider-alicloud that referenced this issue Oct 21, 2024
…s omitted.

This commit fixes issue aliyun#7761. The field "bucket" is be computed, and its references are corrected.
zcxsythenew added a commit to zcxsythenew/terraform-provider-alicloud that referenced this issue Nov 1, 2024
…s omitted.

This commit fixes issue aliyun#7761. The field "bucket" is be computed, and its references are corrected.
zcxsythenew added a commit to zcxsythenew/terraform-provider-alicloud that referenced this issue Nov 1, 2024
…s omitted.

This commit fixes issue aliyun#7761. The field "bucket" is be computed, and its references are corrected.
zcxsythenew added a commit to zcxsythenew/terraform-provider-alicloud that referenced this issue Nov 1, 2024
…s omitted.

This commit fixes issue aliyun#7761. The field "bucket" is be computed, and its references are corrected.
zcxsythenew added a commit to zcxsythenew/terraform-provider-alicloud that referenced this issue Nov 1, 2024
…s omitted.

This commit fixes issue aliyun#7761. The field "bucket" is be computed, and its references are corrected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant