yandex-cloud / terraform-provider-yandex

Terraform Yandex provider
https://www.terraform.io/docs/providers/yandex/
Mozilla Public License 2.0
211 stars 116 forks source link

yandex_storage_bucket: can't provide IAM-token from provider #474

Open a1ndreay opened 1 month ago

a1ndreay commented 1 month ago

Trouble: The storage service does not accept the IAM token as authorization method Purpose: Use an IAM token instead of an SA (service account) Steps for reproduce: I'm provide a token - (Optional) Security token or IAM token used for authentication in Yandex.Cloud. into provider block:

 provider "yandex" {
  cloud_id  = local.cloud_id
  folder_id = local.folder_id
  zone      = local.zone
  token     = var.IAM_TOKEN #<-- MY IAM TOKEN
}

But there's an error ocurred while no access_key and secret_key provide to storage client https://terraform-provider.yandexcloud.net/Resources/storage_bucket#argument-reference:

resource "yandex_storage_bucket" "test" {
  folder_id = data.yandex_resourcemanager_folder.students_ext_11.folder_id
  bucket = local.bucket
  #access_key = yandex_iam_service_account_static_access_key.sa-static-key.access_key
  #secret_key = yandex_iam_service_account_static_access_key.sa-static-key.secret_key
  max_size = 1048576  #<--- MAX_SIZE requires an IAM-token, not static access key! 
}
image

But as you can see above, an error occurs without specifying the static access key: " error getting storage client: failed to get default storage client". How to specify the user providing the IAM key as a client not SA?

Fluffi1235 commented 3 weeks ago

Thank you for your message, we'll pass it on to the team.

art22m commented 2 weeks ago

Hi! This bug is fixed in the v0.131.0 version. See docs https://terraform-provider.yandexcloud.net/resources/storage_bucket.html