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

Add datastorage disk #9

Merged
merged 9 commits into from
Oct 13, 2017
Merged

Add datastorage disk #9

merged 9 commits into from
Oct 13, 2017

Conversation

jmapro
Copy link

@jmapro jmapro commented Oct 3, 2017

Add datadisk to instances

@dtzar
Copy link
Contributor

dtzar commented Oct 9, 2017

Looks good. I just don't want to force people to use a datastorage disk, so can you make it a conditional?

@jmapro
Copy link
Author

jmapro commented Oct 11, 2017

To make datadisk conditional I had to create two new resources named vm-linux-with-datadisk and vm-windows-with-datadisk and change the condition to use it.
It may not the best way to do that, but due to HCL limitation I have not found any other solution.

Copy link
Contributor

@dtzar dtzar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once these changes are implemented/merged and I update/test the readme, then I will tag as new 1.1.0 release.

main.tf Outdated
}

storage_os_disk {
name = "osdisk${count.index}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to "osdisk-${var.vm_hostname}-${count.index}" to make things consistent and prevent same named disk conflicts.

Please fix on line 195 as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

main.tf Outdated
@@ -48,11 +48,19 @@ resource "azurerm_virtual_machine" "vm-linux" {
}

storage_os_disk {
name = "osdisk-${var.vm_hostname}-${count.index}"
name = "osdisk${count.index}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to "osdisk-${var.vm_hostname}-${count.index}" to make things consistent and prevent same named disk conflicts.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

variables.tf Outdated
default = ""
}

variable "datadisk" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: keep names consistent with _ so data_disk

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

main.tf Outdated
}

storage_data_disk {
name = "datadisk-${var.vm_hostname}-${count.index}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: keep spacing with = aligned throughout (i.e. here, lines 201-208, etc)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

main.tf Outdated
@@ -30,7 +30,7 @@ resource "azurerm_storage_account" "vm-sa" {
}

resource "azurerm_virtual_machine" "vm-linux" {
count = "${contains(list("${var.vm_os_simple}","${var.vm_os_offer}"), "WindowsServer") ? 0 : var.nb_instances}"
count = "${!contains(list("${var.vm_os_simple}","${var.vm_os_offer}"), "WindowsServer") && var.datadisk == "false" ? var.nb_instances : 0}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic does not work for me. I am unable to provision a VM without a datadisk.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Regression from a bad merge :(

@dtzar
Copy link
Contributor

dtzar commented Oct 13, 2017

I updated the readme to be current with the code up there in this PR #17. If you want to add the data disk option for the Windows VM in the "advanced" example, that'd be cool.

@dtzar
Copy link
Contributor

dtzar commented Oct 13, 2017

LGTM. Thanks for your contribution!

@dtzar dtzar merged commit c9690a9 into Azure:master Oct 13, 2017
@jmapro jmapro deleted the add_datadisk branch October 18, 2017 07:10
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.

2 participants