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

cloudflare_account_member import fails with Error: account ID is empty and must be provided #978

Closed
gabriellisboa opened this issue Mar 5, 2021 · 4 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@gabriellisboa
Copy link

gabriellisboa commented Mar 5, 2021

Terraform version

Terraform v0.14.7

  • provider registry.terraform.io/cloudflare/cloudflare v2.18.0

Affected resource(s)

  • cloudflare_account_member

Terraform configuration files

account_member.tf

resource "cloudflare_account_member" "user" {
    email_address = "user@email"
    role_ids = [var.admin_role_id,]
}

main.tf

provider "cloudflare" {
  email   = var.cloudflare_email 
  api_key = var.cloudflare_api_key
}

terraform {
  required_version = ">= 0.14.7"

  backend "remote" {
    organization = "xxxxxxxx"
    workspaces {
      name = "cloudflare"
    }
  }
}

Debug output

https://gist.github.com/gabriellisboa/bbf575842fe409b7ae331661423ce0c4

Panic output

No panic output

Expected behavior

The account_member should have been imported.

Actual behavior

Error: account ID is empty and must be provided

Steps to reproduce

  1. terraform init
  2. TF_LOG=DEBUG terraform import cloudflare_account_member.user acc_id/member_id

Important factoids

Using terraform cloud state. Import is successful for filter, firewall_rule, rate_limit, record, and zone. Just account_member is falling.

References

None

Community note

  • Please vote on this issue by adding a 👍 reaction
    to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull
    request, please leave a comment
@gabriellisboa gabriellisboa added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 5, 2021
@jacobbednarz
Copy link
Member

do you have account_id defined in your provider configuration block?

@jacobbednarz jacobbednarz added triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 7, 2021
@gabriellisboa
Copy link
Author

No. This is my provider/state configuration:

provider "cloudflare" {
  email   = var.cloudflare_email
  api_key = var.cloudflare_api_key
}

terraform {
  required_version = ">= 0.14.7"

  backend "remote" {
    organization = "xxx"
    workspaces {
      name = "xxx"
    }
  }
}

Should I try to add the optional account_id argument? Thank you for the answer!

@gabriellisboa
Copy link
Author

gabriellisboa commented Mar 8, 2021

Just did it and it works.
If anyone is struggling with this, the fix for me was to add account_id argument to my provider configuration like following:

provider "cloudflare" {
  email   = var.cloudflare_email
  api_key = var.cloudflare_api_key
  account_id = var.cloudflare_account_id
}

terraform {
  required_version = ">= 0.14.7"

  backend "remote" {
    organization = "xxx"
    workspaces {
      name = "xxx"
    }
  }
}

Thank you for the support @jacobbednarz 🤗 !

@jacobbednarz
Copy link
Member

Thanks for confirming! We can fix this similar to #916 to use the provided accountID from the import string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

2 participants