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

Azure templates not working - maybe deprecated? #78

Open
thiagofborn opened this issue Oct 3, 2019 · 10 comments
Open

Azure templates not working - maybe deprecated? #78

thiagofborn opened this issue Oct 3, 2019 · 10 comments
Assignees

Comments

@thiagofborn
Copy link

Hello there.

I hope you guys are doing fine. After the easy pick fixes, I stuck here. [1]

  • Terraform v0.12.8
  • "azurerm" (hashicorp/azurerm) 1.34.0...
  • "random" (hashicorp/random) 2.2.1...
  • "template" (hashicorp/template) 2.1.2...

Linux born-Surface-Book-2 5.1.15-surface-linux-surface #8 SMP Thu Jun 27 12:03:55 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux

I changed the number of the variables.tf to 5 :
masters_count results in the first error.

Call to function "format" failed: unsupported value for "%d" at 0: an integer

[1] Error:

Error: Error in function call

  on clients.tf line 14, in data "template_file" "client_userdata_script":
  14:     minimum_master_nodes    = "${format("%d", var.masters_count / 2 + 1)}"
    |----------------
    | var.masters_count is "1"

Call to function "format" failed: unsupported value for "%d" at 0: an integer
is required.


Error: Error in function call

  on datas.tf line 14, in data "template_file" "data_userdata_script":
  14:     minimum_master_nodes    = "${format("%d", var.masters_count / 2 + 1)}"
    |----------------
    | var.masters_count is "1"

Call to function "format" failed: unsupported value for "%d" at 0: an integer
is required.

  on main.tf line 1, in provider "azurerm":
   1: provider "azurerm" {

Error: Error in function call

  on masters.tf line 14, in data "template_file" "master_userdata_script":
  14:     minimum_master_nodes    = "${format("%d", var.masters_count / 2 + 1)}"
    |----------------
    | var.masters_count is "1"

Call to function "format" failed: unsupported value for "%d" at 0: an integer

Just to make it run, I have changed master_count to 6:

variable "masters_count" {
  default = "6"
}

variable "datas_count" {
  default = "5"
}

Then just to take a look at it running.

 
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.template_file.master_userdata_script: Refreshing state...
data.template_file.data_userdata_script: Refreshing state...
data.azurerm_image.elasticsearch: Refreshing state...
data.azurerm_image.kibana: Refreshing state...

Error: failed to render : :5,9-23: Unknown variable; There is no variable named "bootstrap_node"., and 10 other diagnostic(s)

  on datas.tf line 1, in data "template_file" "data_userdata_script":
   1: data "template_file" "data_userdata_script" {



Error: Error: Unable to list images for Resource Group "packer-elasticsearch-images"

  on images.tf line 1, in data "azurerm_image" "elasticsearch":
   1: data "azurerm_image" "elasticsearch" {



Error: Error: Unable to list images for Resource Group "packer-elasticsearch-images"

  on images.tf line 7, in data "azurerm_image" "kibana":
   7: data "azurerm_image" "kibana" {



Error: failed to render : :5,9-23: Unknown variable; There is no variable named "bootstrap_node"., and 10 other diagnostic(s)

  on masters.tf line 1, in data "template_file" "master_userdata_script":
   1: data "template_file" "master_userdata_script" {

@aranair
Copy link

aranair commented Oct 25, 2019

There's a bunch of stuff in user_data.sh that is specific to the aws side... removing those allowed me to run this, altho.. this begs the question whether azure ones are even updated at all lol

@synhershko
Copy link
Member

Thanks @thiagofborn we will have a look.

@aranair this is intentional, there is also Azure specific stuff there but yeah it's been a while since we needed to deploy on Azure and it's probably worth testing it again.

@tsimonyan can you please have a look?

@aranair
Copy link

aranair commented Oct 28, 2019

template_file -> I believe this looks at all the variables in the target template file and, unfortunately even if there are if/else clauses for aws, those nested variables would still get evaluated by terraform so if they dont exist on the azure side, it just ...refuses to plan it; I think that's the source of those errors^

@tsimonyan
Copy link
Contributor

I've made some changes on azure-7.x branch, now terraform apply runs correctly and cluster deploys.
Have moved the cluster bootstrapping logic we had for AWS to Azure, so deploying the cluster will also launch an extra bootstrapping node. There are some issues with it's auto-termination, so this still needs some work.

@aranair
Copy link

aranair commented Nov 4, 2019

Just wondering @tsimonyan what version of terraform are you working off of?

There's a bunch of stuff I still had to modify for it to even run terraform validate (mostly related to vars = and then count related issues

@aranair
Copy link

aranair commented Nov 4, 2019

Also, it seems like there are some permission errors on the bootstrap process:

Message="The client 'xxx' with object id 'xxx' does not have authorization to perform action 'Microsoft.Authorization/roleAssignments/write' over scope '/subscrip
tions/xxx' or the scope is invalid.

I believe those ^^^ are generated right?

@synhershko
Copy link
Member

@aranair it's been a while since we had to deploy and maintain ES clusters on Azure, all our customers are using either AWS or GCP apparently :)

Tigran's branch now definitely contains a working cluster also for ES7, but it might take a while until we prettify and perfect it. In the meantime if you need more urgent help help with setting a cluster up on Azure, and then maintaining your cluster with proper data models and 24/7 support - do feel free to reach out. Our website has the details.

@Pooja-H
Copy link

Pooja-H commented Feb 18, 2020

@aranair can we get Azure related user_data.sh only plz

@aranair
Copy link

aranair commented Feb 21, 2020

I'm fairly sure there were other changes needed (and im also not sure if what I have now is different than whats in that branch :P)
https://gist.github.com/aranair/e7185f72551d9fd2ca90e9d593c2b44e

@josemarcosrf
Copy link

josemarcosrf commented Jun 12, 2020

Also, it seems like there are some permission errors on the bootstrap process:

Message="The client 'xxx' with object id 'xxx' does not have authorization to perform action 'Microsoft.Authorization/roleAssignments/write' over scope '/subscrip
tions/xxx' or the scope is invalid.

I believe those ^^^ are generated right?

I run on to the same issue. The Collaborator role assigned during the pre-packer steps is not sufficient.

For the time being I did add manually (Azure portal) the Owner role to the Azure AD Service Principal that the packer step requires.

With this the cluster gets created. Although seems to be some issue with the load-balancers that I haven't yet sorted out.

I've forked the repo and made some changes to:

  • The commands to execute in PowerShell before running packer
  • The scripts to install Kibana
  • Upgrade syntax with terraform 0.12upgrade

I am now trying to figure out some error with the load balancer.

disclaimer I barely understand packer, terraform etc so I am doing a bit of guess-work...

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

No branches or pull requests

6 participants