-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial sketch of acceptance test environment.
Relates to #3.
- Loading branch information
Showing
4 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## Provider configuration | ||
|
||
# The Id of the target Azure subscription. | ||
variable "azure_subscription_id" { sensitive = true } | ||
|
||
# The client Id used to authenticate to Azure. | ||
variable "azure_client_id" { sensitive = true } | ||
|
||
# The client secret used to authenticate to Azure. | ||
variable "azure_client_secret" { sensitive = true } | ||
|
||
# The Id of target Azure AD tenant. | ||
variable "azure_tenant_id" { sensitive = true } | ||
|
||
provider "azurerm" { | ||
subscription_id = "${azure_subscription_id}" | ||
client_id = "${azure_client_id}" | ||
client_secret = "${azure_client_secret}" | ||
tenant_id = "${azure_tenant_id}" | ||
} | ||
|
||
## Common configuration | ||
|
||
# The name of the target Azure region (i.e. datacenter). | ||
variable "region_name" { default = "West Central US" } | ||
|
||
# The name of the resource group that holds the Octopus server used by acceptance tests. | ||
variable "resource_group_name" { default = "terraform-provider-octopus-acctest" } | ||
|
||
# Used to prevent naming clashes between multiple concurrent deployments. | ||
variable "uniqueness_key" { default = "acctest" } | ||
|
||
# TODO: Define other variables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Public IP address for access to the target VM. | ||
resource "azurerm_public_ip" "primary" { | ||
name = "tf-octo-acc-test-${var.uniqueness_key}-pip" | ||
location = "${var.region_name}" | ||
resource_group_name = "${var.resource_group_name}" | ||
|
||
public_ip_address_allocation = "static" | ||
} | ||
|
||
# The primary network for the target VM. | ||
resource "azurerm_virtual_network" "primary" { | ||
name = "tf-octo-acc-test-${var.uniqueness_key}-network" | ||
address_space = ["10.7.0.0/16"] | ||
location = "${var.region_name}" | ||
resource_group_name = "${var.resource_group_name}" | ||
} | ||
|
||
# The primary subnet for the target VM. | ||
resource "azurerm_subnet" "primary" { | ||
name = "tf-octo-acc-test-${var.uniqueness_key}-subnet" | ||
resource_group_name = "${var.resource_group_name}" | ||
virtual_network_name = "${azurerm_virtual_network.primary.name}" | ||
address_prefix = "10.7.1.0/24" | ||
} | ||
|
||
# The primary network adapter for the target VM. | ||
resource "azurerm_network_interface" "primary" { | ||
name = "octo-${var.uniqueness_key}-ni" | ||
location = "${var.region_name}" | ||
resource_group_name = "${var.resource_group_name}" | ||
|
||
ip_configuration { | ||
name = "octo-${var.uniqueness_key}-ni-config" | ||
subnet_id = "${azurerm_subnet.primary.id}" | ||
|
||
# Hook up public IP to private IP. | ||
public_ip_address_id = "${azurerm_public_ip.primary.id}" | ||
|
||
private_ip_address_allocation = "dynamic" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Storage configuration | ||
|
||
resource "azurerm_storage_container" "primary" { | ||
name = "tf-octo-acc-test-${var.uniqueness_key}" | ||
resource_group_name = "${var.resource_group_name}" | ||
storage_account_name = "${var.storage_acct_name}" | ||
container_access_type = "private" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# The Octopus Deploy virtual machine. | ||
resource "azurerm_virtual_machine" "octo" { | ||
name = "octo-${var.uniqueness_key}" | ||
location = "${var.region_name}" | ||
resource_group_name = "${var.resource_group_name}" | ||
network_interface_ids = [ "${azurerm_network_interface.primary.id}" ] | ||
|
||
vm_size = "${var.instance_type}" | ||
|
||
storage_image_reference { | ||
publisher = "Canonical" | ||
offer = "UbuntuServer" | ||
sku = "14.04.2-LTS" | ||
version = "latest" | ||
} | ||
|
||
storage_os_disk { | ||
name = "octo-${var.uniqueness_key}-osdisk1" | ||
vhd_uri = "https://${var.storage_acct_name}.blob.core.windows.net/${azurerm_storage_container.primary.name}/octo-${var.uniqueness_key}-osdisk1.vhd" | ||
caching = "ReadWrite" | ||
create_option = "FromImage" | ||
} | ||
|
||
os_profile { | ||
computer_name = "octo-${var.uniqueness_key}" | ||
admin_username = "octo-admin" | ||
admin_password = "${var.initial_admin_password}" | ||
} | ||
|
||
# os_profile_linux_config { | ||
# disable_password_authentication = true | ||
# ssh_keys { | ||
# path = "/home/ubuntu/.ssh/authorized_keys" | ||
# key_data = "${var.ssh_key}" | ||
# } | ||
# } | ||
|
||
tags { | ||
public_ip = "${azurerm_public_ip.primary.ip_address}" | ||
private_ip = "${azurerm_network_interface.primary.private_ip_address}" | ||
} |