-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/azure: added a number of storage and networking resources. #2052
Changes from all commits
9670e69
137cb97
329424c
ebfbef0
bd371a3
548a17d
82a7f08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package azure | ||
|
||
const ( | ||
// terraformAzureLabel is used as the label for the hosted service created | ||
// by Terraform on Azure. | ||
terraformAzureLabel = "terraform-on-azure" | ||
|
||
// terraformAzureDescription is the description used for the hosted service | ||
// created by Terraform on Azure. | ||
terraformAzureDescription = "Hosted service automatically created by terraform." | ||
) | ||
|
||
// parameterDescriptions holds a list of descriptions for all the available | ||
// parameters of an Azure configuration. | ||
var parameterDescriptions = map[string]string{ | ||
// provider descriptions: | ||
"management_url": "The URL of the management API all requests should be sent to.\n" + | ||
"Defaults to 'https://management.core.windows.net/', which is the default Azure API URL.\n" + | ||
"This should be filled in only if you have your own datacenter with its own hosted management API.", | ||
"management_certificate": "The certificate for connecting to the management API specified with 'management_url'", | ||
"subscription_id": "The subscription ID to be used when connecting to the management API.", | ||
"publish_settings_file": "The publish settings file, either created by you or downloaded from 'https://manage.windowsazure.com/publishsettings'", | ||
// general resource descriptions: | ||
"name": "Name of the resource to be created as it will appear in the Azure dashboard.", | ||
"service_name": "Name of the hosted service within Azure. Will have a DNS entry as dns-name.cloudapp.net", | ||
"location": "The Azure location where the resource will be located.\n" + | ||
"A list of Azure locations can be found here: http://azure.microsoft.com/en-us/regions/", | ||
"reverse_dns_fqdn": "The reverse of the fully qualified domain name. Optional.", | ||
"label": "Label by which the resource will be identified by. Optional.", | ||
"description": "Brief description of the resource. Optional.", | ||
// hosted service descriptions: | ||
"ephemeral_contents": "Sets whether the associated contents of this resource should also be\n" + | ||
"deleted upon this resource's deletion. Default is false.", | ||
// instance descriptions: | ||
"image": "The image the new VM will be booted from. Mandatory.", | ||
"size": "The size in GB of the disk to be created. Mandatory.", | ||
"os_type": "The OS type of the VM. Either Windows or Linux. Mandatory.", | ||
"storage_account": "The storage account (pool) name. Mandatory.", | ||
"storage_container": "The storage container name from the storage pool given with 'storage_pool'.", | ||
"user_name": "The user name to be configured on the new VM.", | ||
"user_password": "The user password to be configured on the new VM.", | ||
"default_certificate_thumbprint": "The thumbprint of the WinRM Certificate to be used as a default.", | ||
// local network descriptions: | ||
"vpn_gateway_address": "The IP address of the VPN gateway bridged through this virtual network.", | ||
"address_space_prefixes": "List of address space prefixes in the format '<IP>/netmask'", | ||
// dns descriptions: | ||
"dns_address": "Address of the DNS server. Required.", | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,18 @@ import ( | |
var testAccProviders map[string]terraform.ResourceProvider | ||
var testAccProvider *schema.Provider | ||
|
||
const testAccSecurityGroupName = "terraform-security-group" | ||
|
||
// testAccStorageServiceName is used as the name for the Storage Service | ||
// created in all storage-related tests. | ||
// It is much more convenient to provide a Storage Service which | ||
// has been created beforehand as the creation of one takes a lot | ||
// and would greatly impede the multitude of tests which rely on one. | ||
// NOTE: the storage container should be located in `West US`. | ||
var testAccStorageServiceName = os.Getenv("AZURE_STORAGE") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the behavior when this is not set? In other places we've:
From what I can tell the value just ends up empty right now, would be nice to do something more explicit here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, all of the tests run the PreCheck function present below; which fails if the appropriate combination of environment variables used for the creation of the Provider and AZURE_STORAGE is not set. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if I like the consts in this file as normally they ( Having just a single call to get the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constants are a bit dodgy; yes, but I placed them there for a couple of reasons:
|
||
|
||
const testAccStorageContainerName = "terraform-testing-container" | ||
|
||
func init() { | ||
testAccProvider = Provider().(*schema.Provider) | ||
testAccProviders = map[string]terraform.ResourceProvider{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about this again, but did you actually test with your current approach? Because I don't think this will work as you might expect. So how would you share a hosted service between multiple instances?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Azure has this notion of deployment slots per service.
The most straightforward example I can think of is a web app where you have a 'production' machine serving the current version of your app, and a 'dev' machine on which you add new features etc... In such a case; Azure gives you the huge convenience to 'swap' (it's more or less just switching dns refs) your production machine with the dev one whenever you want to roll out a new version of your app, rollback options etc...
Unfortunately, as of right now, the sdk assumes you wish to use the 'Production' slot all the time; however adding a slot decision option there is trivial.
When such a slot mechanism will be added to the sdk; its use could easily be added to the hostedservice resource as a list of TypeString's and users will have the slots options if they so desire it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That (the SDK currently only using the
Production
slot) was one of the main reasons why I thought to just start with a single resource combining all the needed parts. At least until after the SDK is extend, tested and updated with the needed options to enable such use cases, as otherwise we would be offering resources that do not work as people knowing Azure would probably expect.