akshaykarle / terraform-provider-mongodbatlas

Terraform provider for MongoDB Atlas
Mozilla Public License 2.0
122 stars 54 forks source link

Error creating MongoDB Project IP Whitelist: MongoDB Atlas: 401 You are not authorized for this resource #102

Open cnguyenp opened 5 years ago

cnguyenp commented 5 years ago

Note: This is not an issue. This is a request for help.

I am trying to add outbound_ip_addresses from Azure to MongoDB Atlas. And I am having issue with authorization. I have added my IP to whitelist.

I am not sure where do I get usernameand api_keyfor the provider.

provider "mongodbatlas" {
  username = "${var.mongodb_atlas_username}"
  api_key = "${var.mongodb_atlas_api_key}"
}

Here is my resources

resource "mongodbatlas_ip_whitelist" "staging-app-service" {
  group = "xxxxx"

  for_each = toset(split(",", "${azurerm_app_service.jamboree_as.outbound_ip_addresses}"))

  cidr_block = "${each.value}/32"
  comment = "staging outbound ip ${each.key}"

  depends_on = [
      "azurerm_app_service.jamboree_as"
  ]
}

I am getting api_keyfrom here 2019-08-14 16_09_23-Edit API Key _ Atlas_ MongoDB Atlas

and I am getting username from here 2019-08-14 16_16_29-Access Management _ Atlas_ MongoDB Atlas