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

[Fix] Bucket_domain_name can be generated correctly by provider configuration #960

Merged
merged 1 commit into from
Mar 3, 2021
Merged

[Fix] Bucket_domain_name can be generated correctly by provider configuration #960

merged 1 commit into from
Mar 3, 2021

Conversation

Lance52259
Copy link
Contributor

@Lance52259 Lance52259 commented Mar 3, 2021

What this PR does / why we need it:

  • Bucket_domain_name cannot be generated correctly by cloud and endpoint setting.
    • Bucket_domain_name is composed of bucket_name, region and cloud but the current cloud configuration cannot be applied to the cloud part.

Which issue this PR fixes:
(optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged)
fixes #957

Special notes for your reviewer:

Release note:

1. use cloud parameter to build bucket_domain_name when cloud is setting in provider config.

PR Checklist

  • Tests added/passed.
  • Documentation updated.
  • Schema updated.

Acceptance Steps Performed

provider configuration

provider "huaweicloud" {
  auth_url     = "https://iam.ru-moscow-1.hc.sbercloud.ru"
  cloud        = "hc.sbercloud.ru"
  domain_name  = "***"
  region       = "***"
  project_name = "***"
  access_key   = "***"
  secret_key   = "***"
  endpoints = {
    iam = "iam.ru-moscow-1.hc.sbercloud.ru"
    ecs = "ecs.ru-moscow-1.hc.sbercloud.ru"
    obs = "obs.ru-moscow-1.hc.sbercloud.ru"
  }
}

terraform apply

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # huaweicloud_obs_bucket.bucket will be created
  + resource "huaweicloud_obs_bucket" "bucket" {
      + acl                   = "private"
      + bucket                = "tf-test-bucket-demo-0302"
      + bucket_domain_name    = (known after apply)
      + enterprise_project_id = (known after apply)
      + force_destroy         = false
      + id                    = (known after apply)
      + policy                = (known after apply)
      + policy_format         = "obs"
      + quota                 = 0
      + region                = "ru-moscow-1"
      + storage_class         = "STANDARD"
      + versioning            = false
    }

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

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

  Enter a value: yes

huaweicloud_obs_bucket.bucket: Creating...
huaweicloud_obs_bucket.bucket: Creation complete after 7s [id=tf-test-bucket-demo-0302]

terraform show

# huaweicloud_obs_bucket.bucket:
resource "huaweicloud_obs_bucket" "bucket" {
    acl                = "private"
    bucket             = "tf-test-bucket-demo-0302"
    bucket_domain_name = "tf-test-bucket-demo-0302.obs.ru-moscow-1.hc.sbercloud.ru"
    force_destroy      = false
    id                 = "tf-test-bucket-demo-0302"
    policy_format      = "obs"
    quota              = 0
    region             = "ru-moscow-1"
    storage_class      = "STANDARD"
    versioning         = false
}

@ShiChangkuo ShiChangkuo merged commit 5529ca5 into huaweicloud:master Mar 3, 2021
@Lance52259 Lance52259 deleted the br_obs_bucket_domain_active branch March 8, 2021 08:56
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

Successfully merging this pull request may close these issues.

Wrong bucket domain name in terraform state
2 participants