hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.56k stars 9.53k forks source link

Can't create azurerm_cognitive_account kind AnomalyDetector #26297

Closed dgonzalezp closed 4 years ago

dgonzalezp commented 4 years ago

Hello, I'm trying to created an azure cognitive resource of Kind AnomalyDetector. Its on the documentation list.

https://www.terraform.io/docs/providers/azurerm/r/cognitive_account.html

image

But when I try to create it, its failing.

Terraform Version

daniel@Mac02 allow_destroy % terraform version
Terraform v0.13.3
+ provider registry.terraform.io/hashicorp/azurerm v2.26.0

Terraform Configuration Files

resource "azurerm_resource_group" "rg_cognitive" {
  name     = "rg-cognitive"
  location = "uksouth"
}

resource "azurerm_cognitive_account" "anomaly_detector" {
  name                = "cog-anomaly-detector"
  location            = azurerm_resource_group.rg_cognitive.location
  resource_group_name = azurerm_resource_group.rg_cognitive.name

  kind                = "AnomalyDetector"
  sku_name            = "S0"
}

Debug Output

Error: expected kind to be one of [Academic Bing.Autosuggest Bing.Autosuggest.v7 Bing.CustomSearch Bing.Search Bing.Search.v7 Bing.Speech Bing.SpellCheck Bing.SpellCheck.v7 CognitiveServices ComputerVision ContentModerator CustomSpeech CustomVision.Prediction CustomVision.Training Emotion Face FormRecognizer ImmersiveReader LUIS LUIS.Authoring QnAMaker Recommendations SpeakerRecognition Speech SpeechServices SpeechTranslation TextAnalytics TextTranslation WebLM], got AnomalyDetector

  on res_cognitive.tf line 78, in resource "azurerm_cognitive_account" "anomaly_detector":
  78: resource "azurerm_cognitive_account" "anomaly_detector" {

Releasing state lock. This may take a few moments...

References

alisdair commented 4 years ago

Support for the AnomalyDetector was added in version 2.27 of the AzureRM provider, in this PR: https://github.com/terraform-providers/terraform-provider-azurerm/pull/8357

Please upgrade to 2.27.

dgonzalezp commented 4 years ago

Hi @alisdair thanks for your answer!

I see that AzureRM provider is 2.28.0 now but I'm getting an error on terraform init on both 2.28.0 and 2.27.0

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider
hashicorp/azurerm: no available releases match the given constraints 2.27.0
terraform {
  required_version = ">= 0.13"
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "2.27.0"
    }
  }
}
alisdair commented 4 years ago

@dgonzalezp That's confusing! With your exact configuration, Terraform initializes correctly for me:

$ cat main.tf
terraform {
  required_version = ">= 0.13"
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "2.27.0"
    }
  }
}
$ terraform-0.13.3 init

Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/azurerm versions matching "2.27.0"...
- Installing hashicorp/azurerm v2.27.0...
- Installed hashicorp/azurerm v2.27.0 (signed by HashiCorp)

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

Do you have any configuration in your ~/.terraformrc or similar which might be affecting the registry? For example, explicit provider installation configuration blocks.

dgonzalezp commented 4 years ago

Hi @alisdair thank you again for your answer!

Yes, had to delete ~/.terraform.d/plugins folder, it had azurem version 2.26.0 downloaded. So my guess is that terraform was looking in that folder, found only 2.26.0 and stopped looking. Deleted it and worked to download version 2.27.0 and 2.28.0 as well.

Thanks for your help.

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.