Merge branch 'terraform' into hmrc

This commit is contained in:
Brett Mack 2015-11-06 10:22:25 +00:00
commit bda4ef7e7c
12 changed files with 260 additions and 85 deletions

View File

@ -28,11 +28,13 @@ IMPROVEMENTS:
* provider/aws: Add `kinesis_endpoint` for configuring Kinesis [GH-3255] * provider/aws: Add `kinesis_endpoint` for configuring Kinesis [GH-3255]
* provider/aws: Add a computed ARN for S3 Buckets [GH-3685] * provider/aws: Add a computed ARN for S3 Buckets [GH-3685]
* provider/aws: Add configuration to enable copying RDS tags to final snapshot [GH-3529] * provider/aws: Add configuration to enable copying RDS tags to final snapshot [GH-3529]
* provider/aws: RDS Cluster additions (`backup_retention_period`, `preferred_backup_window`, `preferred_maintenance_window`) [GH-3757]
* provider/openstack: Use IPv4 as the defeault IP version for subnets [GH-3091] * provider/openstack: Use IPv4 as the defeault IP version for subnets [GH-3091]
* provider/aws: Apply security group after restoring db_instance from snapshot [GH-3513] * provider/aws: Apply security group after restoring db_instance from snapshot [GH-3513]
* provider/aws: Making the AutoScalingGroup name optional [GH-3710] * provider/aws: Making the AutoScalingGroup name optional [GH-3710]
* provider/openstack: Add "delete on termination" boot-from-volume option [GH-3232] * provider/openstack: Add "delete on termination" boot-from-volume option [GH-3232]
* provider/digitalocean: Make user_data force a new droplet [GH-3740] * provider/digitalocean: Make user_data force a new droplet [GH-3740]
* provider/vsphere: Do not add network interfaces by default [GH-3652]
BUG FIXES: BUG FIXES:
@ -44,8 +46,10 @@ BUG FIXES:
* provider/aws: Allow cluster name, not only ARN for `aws_ecs_service` [GH-3668] * provider/aws: Allow cluster name, not only ARN for `aws_ecs_service` [GH-3668]
* provider/aws: ignore association not exist on route table destroy [GH-3615] * provider/aws: ignore association not exist on route table destroy [GH-3615]
* provider/aws: Fix policy encoding issue with SNS Topics [GH-3700] * provider/aws: Fix policy encoding issue with SNS Topics [GH-3700]
* provider/aws: Tolerate ElastiCache clusters being deleted outside Terraform [GH-3767]
* provider/azure: various bugfixes [GH-3695] * provider/azure: various bugfixes [GH-3695]
* provider/digitalocean: fix issue preventing SSH fingerprints from working [GH-3633] * provider/digitalocean: fix issue preventing SSH fingerprints from working [GH-3633]
* provider/digitalocean: Fixing the DigitalOcean Droplet 404 potential on refresh of state [GH-3768]
* provider/openstack: Fix several issues causing unresolvable diffs [GH-3440] * provider/openstack: Fix several issues causing unresolvable diffs [GH-3440]
* provider/openstack: Safely delete security groups [GH-3696] * provider/openstack: Safely delete security groups [GH-3696]
* provider/openstack: Ignore order of security_groups in instance [GH-3651] * provider/openstack: Ignore order of security_groups in instance [GH-3651]

View File

@ -241,6 +241,12 @@ func resourceAwsElasticacheClusterRead(d *schema.ResourceData, meta interface{})
res, err := conn.DescribeCacheClusters(req) res, err := conn.DescribeCacheClusters(req)
if err != nil { if err != nil {
if eccErr, ok := err.(awserr.Error); ok && eccErr.Code() == "CacheClusterNotFound" {
log.Printf("[WARN] ElastiCache Cluster (%s) not found", d.Id())
d.SetId("")
return nil
}
return err return err
} }

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"log" "log"
"regexp" "regexp"
"strings"
"time" "time"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
@ -122,6 +123,38 @@ func resourceAwsRDSCluster() *schema.Resource {
Elem: &schema.Schema{Type: schema.TypeString}, Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString, Set: schema.HashString,
}, },
"preferred_backup_window": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"preferred_maintenance_window": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
StateFunc: func(val interface{}) string {
if val == nil {
return ""
}
return strings.ToLower(val.(string))
},
},
"backup_retention_period": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Default: 1,
ValidateFunc: func(v interface{}, k string) (ws []string, es []error) {
value := v.(int)
if value > 35 {
es = append(es, fmt.Errorf(
"backup retention period cannot be more than 35 days"))
}
return
},
},
}, },
} }
} }
@ -156,6 +189,18 @@ func resourceAwsRDSClusterCreate(d *schema.ResourceData, meta interface{}) error
createOpts.AvailabilityZones = expandStringList(attr.List()) createOpts.AvailabilityZones = expandStringList(attr.List())
} }
if v, ok := d.GetOk("backup_retention_period"); ok {
createOpts.BackupRetentionPeriod = aws.Int64(int64(v.(int)))
}
if v, ok := d.GetOk("preferred_backup_window"); ok {
createOpts.PreferredBackupWindow = aws.String(v.(string))
}
if v, ok := d.GetOk("preferred_maintenance_window"); ok {
createOpts.PreferredMaintenanceWindow = aws.String(v.(string))
}
log.Printf("[DEBUG] RDS Cluster create options: %s", createOpts) log.Printf("[DEBUG] RDS Cluster create options: %s", createOpts)
resp, err := conn.CreateDBCluster(createOpts) resp, err := conn.CreateDBCluster(createOpts)
if err != nil { if err != nil {
@ -223,6 +268,9 @@ func resourceAwsRDSClusterRead(d *schema.ResourceData, meta interface{}) error {
d.Set("engine", dbc.Engine) d.Set("engine", dbc.Engine)
d.Set("master_username", dbc.MasterUsername) d.Set("master_username", dbc.MasterUsername)
d.Set("port", dbc.Port) d.Set("port", dbc.Port)
d.Set("backup_retention_period", dbc.BackupRetentionPeriod)
d.Set("preferred_backup_window", dbc.PreferredBackupWindow)
d.Set("preferred_maintenance_window", dbc.PreferredMaintenanceWindow)
var vpcg []string var vpcg []string
for _, g := range dbc.VpcSecurityGroups { for _, g := range dbc.VpcSecurityGroups {
@ -263,6 +311,18 @@ func resourceAwsRDSClusterUpdate(d *schema.ResourceData, meta interface{}) error
} }
} }
if d.HasChange("preferred_backup_window") {
req.PreferredBackupWindow = aws.String(d.Get("preferred_backup_window").(string))
}
if d.HasChange("preferred_maintenance_window") {
req.PreferredMaintenanceWindow = aws.String(d.Get("preferred_maintenance_window").(string))
}
if d.HasChange("backup_retention_period") {
req.BackupRetentionPeriod = aws.Int64(int64(d.Get("backup_retention_period").(int)))
}
_, err := conn.ModifyDBCluster(req) _, err := conn.ModifyDBCluster(req)
if err != nil { if err != nil {
return fmt.Errorf("[WARN] Error modifying RDS Cluster (%s): %s", d.Id(), err) return fmt.Errorf("[WARN] Error modifying RDS Cluster (%s): %s", d.Id(), err)

View File

@ -17,13 +17,16 @@ import (
func TestAccAWSRDSCluster_basic(t *testing.T) { func TestAccAWSRDSCluster_basic(t *testing.T) {
var v rds.DBCluster var v rds.DBCluster
ri := rand.New(rand.NewSource(time.Now().UnixNano())).Int()
config := fmt.Sprintf(testAccAWSClusterConfig, ri)
resource.Test(t, resource.TestCase{ resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) }, PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders, Providers: testAccProviders,
CheckDestroy: testAccCheckAWSClusterDestroy, CheckDestroy: testAccCheckAWSClusterDestroy,
Steps: []resource.TestStep{ Steps: []resource.TestStep{
resource.TestStep{ resource.TestStep{
Config: testAccAWSClusterConfig, Config: config,
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckAWSClusterExists("aws_rds_cluster.default", &v), testAccCheckAWSClusterExists("aws_rds_cluster.default", &v),
), ),
@ -32,6 +35,47 @@ func TestAccAWSRDSCluster_basic(t *testing.T) {
}) })
} }
func TestAccAWSRDSCluster_backupsUpdate(t *testing.T) {
var v rds.DBCluster
ri := rand.New(rand.NewSource(time.Now().UnixNano())).Int()
preConfig := fmt.Sprintf(testAccAWSClusterConfig_backups, ri)
postConfig := fmt.Sprintf(testAccAWSClusterConfig_backupsUpdate, ri)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSClusterDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: preConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSClusterExists("aws_rds_cluster.default", &v),
resource.TestCheckResourceAttr(
"aws_rds_cluster.default", "preferred_backup_window", "07:00-09:00"),
resource.TestCheckResourceAttr(
"aws_rds_cluster.default", "backup_retention_period", "5"),
resource.TestCheckResourceAttr(
"aws_rds_cluster.default", "preferred_maintenance_window", "tue:04:00-tue:04:30"),
),
},
resource.TestStep{
Config: postConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSClusterExists("aws_rds_cluster.default", &v),
resource.TestCheckResourceAttr(
"aws_rds_cluster.default", "preferred_backup_window", "03:00-09:00"),
resource.TestCheckResourceAttr(
"aws_rds_cluster.default", "backup_retention_period", "10"),
resource.TestCheckResourceAttr(
"aws_rds_cluster.default", "preferred_maintenance_window", "wed:01:00-wed:01:30"),
),
},
},
})
}
func testAccCheckAWSClusterDestroy(s *terraform.State) error { func testAccCheckAWSClusterDestroy(s *terraform.State) error {
for _, rs := range s.RootModule().Resources { for _, rs := range s.RootModule().Resources {
if rs.Type != "aws_rds_cluster" { if rs.Type != "aws_rds_cluster" {
@ -97,12 +141,36 @@ func testAccCheckAWSClusterExists(n string, v *rds.DBCluster) resource.TestCheck
} }
} }
// Add some random to the name, to avoid collision var testAccAWSClusterConfig = `
var testAccAWSClusterConfig = fmt.Sprintf(`
resource "aws_rds_cluster" "default" { resource "aws_rds_cluster" "default" {
cluster_identifier = "tf-aurora-cluster-%d" cluster_identifier = "tf-aurora-cluster-%d"
availability_zones = ["us-west-2a","us-west-2b","us-west-2c"] availability_zones = ["us-west-2a","us-west-2b","us-west-2c"]
database_name = "mydb" database_name = "mydb"
master_username = "foo" master_username = "foo"
master_password = "mustbeeightcharaters" master_password = "mustbeeightcharaters"
}`, rand.New(rand.NewSource(time.Now().UnixNano())).Int()) }`
var testAccAWSClusterConfig_backups = `
resource "aws_rds_cluster" "default" {
cluster_identifier = "tf-aurora-cluster-%d"
availability_zones = ["us-west-2a","us-west-2b","us-west-2c"]
database_name = "mydb"
master_username = "foo"
master_password = "mustbeeightcharaters"
backup_retention_period = 5
preferred_backup_window = "07:00-09:00"
preferred_maintenance_window = "tue:04:00-tue:04:30"
}`
var testAccAWSClusterConfig_backupsUpdate = `
resource "aws_rds_cluster" "default" {
cluster_identifier = "tf-aurora-cluster-%d"
availability_zones = ["us-west-2a","us-west-2b","us-west-2c"]
database_name = "mydb"
master_username = "foo"
master_password = "mustbeeightcharaters"
backup_retention_period = 10
preferred_backup_window = "03:00-09:00"
preferred_maintenance_window = "wed:01:00-wed:01:30"
apply_immediately = true
}`

View File

@ -186,10 +186,11 @@ func resourceDigitalOceanDropletRead(d *schema.ResourceData, meta interface{}) e
} }
// Retrieve the droplet properties for updating the state // Retrieve the droplet properties for updating the state
droplet, _, err := client.Droplets.Get(id) droplet, resp, err := client.Droplets.Get(id)
if err != nil { if err != nil {
// check if the droplet no longer exists. // check if the droplet no longer exists.
if err.Error() == "Error retrieving droplet: API Error: 404 Not Found" { if resp.StatusCode == 404 {
log.Printf("[WARN] DigitalOcean Droplet (%s) not found", d.Id())
d.SetId("") d.SetId("")
return nil return nil
} }

View File

@ -1000,7 +1000,6 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
NumCPUs: vm.vcpu, NumCPUs: vm.vcpu,
NumCoresPerSocket: 1, NumCoresPerSocket: 1,
MemoryMB: vm.memoryMb, MemoryMB: vm.memoryMb,
DeviceChange: networkDevices,
} }
log.Printf("[DEBUG] virtual machine config spec: %v", configSpec) log.Printf("[DEBUG] virtual machine config spec: %v", configSpec)
@ -1027,8 +1026,7 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
Location: relocateSpec, Location: relocateSpec,
Template: false, Template: false,
Config: &configSpec, Config: &configSpec,
Customization: &customSpec, PowerOn: false,
PowerOn: true,
} }
log.Printf("[DEBUG] clone spec: %v", cloneSpec) log.Printf("[DEBUG] clone spec: %v", cloneSpec)
@ -1048,6 +1046,43 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
} }
log.Printf("[DEBUG] new vm: %v", newVM) log.Printf("[DEBUG] new vm: %v", newVM)
devices, err := newVM.Device(context.TODO())
if err != nil {
log.Printf("[DEBUG] Template devices can't be found")
return err
}
for _, dvc := range devices {
// Issue 3559/3560: Delete all ethernet devices to add the correct ones later
if devices.Type(dvc) == "ethernet" {
err := newVM.RemoveDevice(context.TODO(), dvc)
if err != nil {
return err
}
}
}
// Add Network devices
for _, dvc := range networkDevices {
err := newVM.AddDevice(
context.TODO(), dvc.GetVirtualDeviceConfigSpec().Device)
if err != nil {
return err
}
}
taskb, err := newVM.Customize(context.TODO(), customSpec)
if err != nil {
return err
}
_, err = taskb.WaitForResult(context.TODO(), nil)
if err != nil {
return err
}
log.Printf("[DEBUG]VM customization finished")
newVM.PowerOn(context.TODO())
ip, err := newVM.WaitForIP(context.TODO()) ip, err := newVM.WaitForIP(context.TODO())
if err != nil { if err != nil {
return err return err

View File

@ -15,9 +15,21 @@ import (
func TestAccVSphereVirtualMachine_basic(t *testing.T) { func TestAccVSphereVirtualMachine_basic(t *testing.T) {
var vm virtualMachine var vm virtualMachine
datacenter := os.Getenv("VSPHERE_DATACENTER") var locationOpt string
cluster := os.Getenv("VSPHERE_CLUSTER") var datastoreOpt string
datastore := os.Getenv("VSPHERE_DATASTORE")
if v := os.Getenv("VSPHERE_DATACENTER"); v != "" {
locationOpt += fmt.Sprintf(" datacenter = \"%s\"\n", v)
}
if v := os.Getenv("VSPHERE_CLUSTER"); v != "" {
locationOpt += fmt.Sprintf(" cluster = \"%s\"\n", v)
}
if v := os.Getenv("VSPHERE_RESOURCE_POOL"); v != "" {
locationOpt += fmt.Sprintf(" resource_pool = \"%s\"\n", v)
}
if v := os.Getenv("VSPHERE_DATASTORE"); v != "" {
datastoreOpt = fmt.Sprintf(" datastore = \"%s\"\n", v)
}
template := os.Getenv("VSPHERE_TEMPLATE") template := os.Getenv("VSPHERE_TEMPLATE")
gateway := os.Getenv("VSPHERE_NETWORK_GATEWAY") gateway := os.Getenv("VSPHERE_NETWORK_GATEWAY")
label := os.Getenv("VSPHERE_NETWORK_LABEL") label := os.Getenv("VSPHERE_NETWORK_LABEL")
@ -31,28 +43,23 @@ func TestAccVSphereVirtualMachine_basic(t *testing.T) {
resource.TestStep{ resource.TestStep{
Config: fmt.Sprintf( Config: fmt.Sprintf(
testAccCheckVSphereVirtualMachineConfig_basic, testAccCheckVSphereVirtualMachineConfig_basic,
datacenter, locationOpt,
cluster,
gateway, gateway,
label, label,
ip_address, ip_address,
datastore, datastoreOpt,
template, template,
), ),
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckVSphereVirtualMachineExists("vsphere_virtual_machine.foo", &vm), testAccCheckVSphereVirtualMachineExists("vsphere_virtual_machine.foo", &vm),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"vsphere_virtual_machine.foo", "name", "terraform-test"), "vsphere_virtual_machine.foo", "name", "terraform-test"),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.foo", "datacenter", datacenter),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"vsphere_virtual_machine.foo", "vcpu", "2"), "vsphere_virtual_machine.foo", "vcpu", "2"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"vsphere_virtual_machine.foo", "memory", "4096"), "vsphere_virtual_machine.foo", "memory", "4096"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"vsphere_virtual_machine.foo", "disk.#", "2"), "vsphere_virtual_machine.foo", "disk.#", "2"),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.foo", "disk.0.datastore", datastore),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"vsphere_virtual_machine.foo", "disk.0.template", template), "vsphere_virtual_machine.foo", "disk.0.template", template),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
@ -67,12 +74,23 @@ func TestAccVSphereVirtualMachine_basic(t *testing.T) {
func TestAccVSphereVirtualMachine_dhcp(t *testing.T) { func TestAccVSphereVirtualMachine_dhcp(t *testing.T) {
var vm virtualMachine var vm virtualMachine
datacenter := os.Getenv("VSPHERE_DATACENTER") var locationOpt string
cluster := os.Getenv("VSPHERE_CLUSTER") var datastoreOpt string
datastore := os.Getenv("VSPHERE_DATASTORE")
if v := os.Getenv("VSPHERE_DATACENTER"); v != "" {
locationOpt += fmt.Sprintf(" datacenter = \"%s\"\n", v)
}
if v := os.Getenv("VSPHERE_CLUSTER"); v != "" {
locationOpt += fmt.Sprintf(" cluster = \"%s\"\n", v)
}
if v := os.Getenv("VSPHERE_RESOURCE_POOL"); v != "" {
locationOpt += fmt.Sprintf(" resource_pool = \"%s\"\n", v)
}
if v := os.Getenv("VSPHERE_DATASTORE"); v != "" {
datastoreOpt = fmt.Sprintf(" datastore = \"%s\"\n", v)
}
template := os.Getenv("VSPHERE_TEMPLATE") template := os.Getenv("VSPHERE_TEMPLATE")
label := os.Getenv("VSPHERE_NETWORK_LABEL_DHCP") label := os.Getenv("VSPHERE_NETWORK_LABEL_DHCP")
password := os.Getenv("VSPHERE_VM_PASSWORD")
resource.Test(t, resource.TestCase{ resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) }, PreCheck: func() { testAccPreCheck(t) },
@ -82,27 +100,21 @@ func TestAccVSphereVirtualMachine_dhcp(t *testing.T) {
resource.TestStep{ resource.TestStep{
Config: fmt.Sprintf( Config: fmt.Sprintf(
testAccCheckVSphereVirtualMachineConfig_dhcp, testAccCheckVSphereVirtualMachineConfig_dhcp,
datacenter, locationOpt,
cluster,
label, label,
datastore, datastoreOpt,
template, template,
password,
), ),
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckVSphereVirtualMachineExists("vsphere_virtual_machine.bar", &vm), testAccCheckVSphereVirtualMachineExists("vsphere_virtual_machine.bar", &vm),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"vsphere_virtual_machine.bar", "name", "terraform-test"), "vsphere_virtual_machine.bar", "name", "terraform-test"),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.bar", "datacenter", datacenter),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"vsphere_virtual_machine.bar", "vcpu", "2"), "vsphere_virtual_machine.bar", "vcpu", "2"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"vsphere_virtual_machine.bar", "memory", "4096"), "vsphere_virtual_machine.bar", "memory", "4096"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"vsphere_virtual_machine.bar", "disk.#", "1"), "vsphere_virtual_machine.bar", "disk.#", "1"),
resource.TestCheckResourceAttr(
"vsphere_virtual_machine.bar", "disk.0.datastore", datastore),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"vsphere_virtual_machine.bar", "disk.0.template", template), "vsphere_virtual_machine.bar", "disk.0.template", template),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
@ -168,20 +180,6 @@ func testAccCheckVSphereVirtualMachineExists(n string, vm *virtualMachine) resou
} }
_, err = object.NewSearchIndex(client.Client).FindChild(context.TODO(), dcFolders.VmFolder, rs.Primary.Attributes["name"]) _, err = object.NewSearchIndex(client.Client).FindChild(context.TODO(), dcFolders.VmFolder, rs.Primary.Attributes["name"])
/*
vmRef, err := client.SearchIndex().FindChild(dcFolders.VmFolder, rs.Primary.Attributes["name"])
if err != nil {
return fmt.Errorf("error %s", err)
}
found := govmomi.NewVirtualMachine(client, vmRef.Reference())
fmt.Printf("%v", found)
if found.Name != rs.Primary.ID {
return fmt.Errorf("Instance not found")
}
*instance = *found
*/
*vm = virtualMachine{ *vm = virtualMachine{
name: rs.Primary.ID, name: rs.Primary.ID,
@ -194,8 +192,7 @@ func testAccCheckVSphereVirtualMachineExists(n string, vm *virtualMachine) resou
const testAccCheckVSphereVirtualMachineConfig_basic = ` const testAccCheckVSphereVirtualMachineConfig_basic = `
resource "vsphere_virtual_machine" "foo" { resource "vsphere_virtual_machine" "foo" {
name = "terraform-test" name = "terraform-test"
datacenter = "%s" %s
cluster = "%s"
vcpu = 2 vcpu = 2
memory = 4096 memory = 4096
gateway = "%s" gateway = "%s"
@ -205,7 +202,7 @@ resource "vsphere_virtual_machine" "foo" {
subnet_mask = "255.255.255.0" subnet_mask = "255.255.255.0"
} }
disk { disk {
datastore = "%s" %s
template = "%s" template = "%s"
iops = 500 iops = 500
} }
@ -219,22 +216,15 @@ resource "vsphere_virtual_machine" "foo" {
const testAccCheckVSphereVirtualMachineConfig_dhcp = ` const testAccCheckVSphereVirtualMachineConfig_dhcp = `
resource "vsphere_virtual_machine" "bar" { resource "vsphere_virtual_machine" "bar" {
name = "terraform-test" name = "terraform-test"
datacenter = "%s" %s
cluster = "%s"
vcpu = 2 vcpu = 2
memory = 4096 memory = 4096
network_interface { network_interface {
label = "%s" label = "%s"
} }
disk { disk {
datastore = "%s" %s
template = "%s" template = "%s"
} }
connection {
host = "${self.network_interface.0.ip_address}"
user = "root"
password = "%s"
}
} }
` `

View File

@ -24,6 +24,8 @@ resource "aws_rds_cluster" "default" {
database_name = "mydb" database_name = "mydb"
master_username = "foo" master_username = "foo"
master_password = "bar" master_password = "bar"
backup_retention_period = 5
preferred_backup_window = "07:00-09:00"
} }
``` ```
@ -52,6 +54,9 @@ string.
instances in the DB cluster can be created in instances in the DB cluster can be created in
* `backup_retention_period` - (Optional) The days to retain backups for. Default * `backup_retention_period` - (Optional) The days to retain backups for. Default
1 1
* `preferred_backup_window` - (Optional) The daily time range during which automated backups are created if automated backups are enabled using the BackupRetentionPeriod parameter.
Default: A 30-minute window selected at random from an 8-hour block of time per region. e.g. 04:00-09:00
* `preferred_maintenance_window` - (Optional) The weekly time range during which system maintenance can occur, in (UTC) e.g. wed:04:00-wed:04:30
* `port` - (Optional) The port on which the DB accepts connections * `port` - (Optional) The port on which the DB accepts connections
* `vpc_security_group_ids` - (Optional) List of VPC security groups to associate * `vpc_security_group_ids` - (Optional) List of VPC security groups to associate
with the Cluster with the Cluster
@ -70,7 +75,8 @@ The following attributes are exported:
* `allocated_storage` - The amount of allocated storage * `allocated_storage` - The amount of allocated storage
* `availability_zones` - The availability zone of the instance * `availability_zones` - The availability zone of the instance
* `backup_retention_period` - The backup retention period * `backup_retention_period` - The backup retention period
* `backup_window` - The backup window * `preferred_backup_window` - The backup window
* `preferred_maintenance_window` - The maintenance window
* `endpoint` - The primary, writeable connection endpoint * `endpoint` - The primary, writeable connection endpoint
* `engine` - The database engine * `engine` - The database engine
* `engine_version` - The database engine version * `engine_version` - The database engine version
@ -80,6 +86,7 @@ The following attributes are exported:
* `status` - The RDS instance status * `status` - The RDS instance status
* `username` - The master username for the database * `username` - The master username for the database
* `storage_encrypted` - Specifies whether the DB instance is encrypted * `storage_encrypted` - Specifies whether the DB instance is encrypted
* `preferred_backup_window` - The daily time range during which the backups happen
[1]: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.Replication.html [1]: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.Replication.html

View File

@ -1,27 +1,28 @@
--- ---
layout: "vsphere" layout: "vsphere"
page_title: "Provider: vSphere" page_title: "Provider: VMware vSphere"
sidebar_current: "docs-vsphere-index" sidebar_current: "docs-vsphere-index"
description: |- description: |-
The vSphere provider is used to interact with the resources supported by The VMware vSphere provider is used to interact with the resources supported by
vSphere. The provider needs to be configured with the proper credentials before VMware vSphere. The provider needs to be configured with the proper credentials
it can be used. before it can be used.
--- ---
# vSphere Provider # VMware vSphere Provider
The vSphere provider is used to interact with the resources supported by vSphere. The VMware vSphere provider is used to interact with the resources supported by
VMware vSphere.
The provider needs to be configured with the proper credentials before it can be used. The provider needs to be configured with the proper credentials before it can be used.
Use the navigation to the left to read about the available resources. Use the navigation to the left to read about the available resources.
~> **NOTE:** The vSphere Provider currently represents _initial support_ and ~> **NOTE:** The VMware vSphere Provider currently represents _initial support_
therefore may undergo significant changes as the community improves it. and therefore may undergo significant changes as the community improves it.
## Example Usage ## Example Usage
``` ```
# Configure the vSphere Provider # Configure the VMware vSphere Provider
provider "vsphere" { provider "vsphere" {
user = "${var.vsphere_user}" user = "${var.vsphere_user}"
password = "${var.vsphere_password}" password = "${var.vsphere_password}"
@ -47,7 +48,7 @@ resource "vsphere_virtual_machine" "web" {
## Argument Reference ## Argument Reference
The following arguments are used to configure the vSphere Provider: The following arguments are used to configure the VMware vSphere Provider:
* `user` - (Required) This is the username for vSphere API operations. Can also * `user` - (Required) This is the username for vSphere API operations. Can also
be specified with the `VSPHERE_USER` environment variable. be specified with the `VSPHERE_USER` environment variable.
@ -59,20 +60,24 @@ The following arguments are used to configure the vSphere Provider:
## Acceptance Tests ## Acceptance Tests
The vSphere provider's acceptance tests require the above provider The VMware vSphere provider's acceptance tests require the above provider
configuration fields to be set using the documented environment variables. configuration fields to be set using the documented environment variables.
In addition, the following environment variables are used in tests, and must be set to valid values for your vSphere environment: In addition, the following environment variables are used in tests, and must be set to valid values for your VMware vSphere environment:
* VSPHERE\_CLUSTER
* VSPHERE\_DATACENTER
* VSPHERE\_DATASTORE
* VSPHERE\_NETWORK\_GATEWAY * VSPHERE\_NETWORK\_GATEWAY
* VSPHERE\_NETWORK\_IP\_ADDRESS * VSPHERE\_NETWORK\_IP\_ADDRESS
* VSPHERE\_NETWORK\_LABEL * VSPHERE\_NETWORK\_LABEL
* VSPHERE\_NETWORK\_LABEL\_DHCP * VSPHERE\_NETWORK\_LABEL\_DHCP
* VSPHERE\_TEMPLATE * VSPHERE\_TEMPLATE
* VSPHERE\_VM\_PASSWORD
The following environment variables depend on your vSphere environment:
* VSPHERE\_DATACENTER
* VSPHERE\_CLUSTER
* VSPHERE\_RESOURCE\_POOL
* VSPHERE\_DATASTORE
These are used to set and verify attributes on the `vsphere_virtual_machine` These are used to set and verify attributes on the `vsphere_virtual_machine`
resource in tests. resource in tests.

View File

@ -1,14 +1,14 @@
--- ---
layout: "vsphere" layout: "vsphere"
page_title: "vSphere: vsphere_virtual_machine" page_title: "VMware vSphere: vsphere_virtual_machine"
sidebar_current: "docs-vsphere-resource-virtual-machine" sidebar_current: "docs-vsphere-resource-virtual-machine"
description: |- description: |-
Provides a vSphere virtual machine resource. This can be used to create, modify, and delete virtual machines. Provides a VMware vSphere virtual machine resource. This can be used to create, modify, and delete virtual machines.
--- ---
# vsphere\_virtual\_machine # vsphere\_virtual\_machine
Provides a vSphere virtual machine resource. This can be used to create, Provides a VMware vSphere virtual machine resource. This can be used to create,
modify, and delete virtual machines. modify, and delete virtual machines.
## Example Usage ## Example Usage

View File

@ -198,9 +198,8 @@
</li> </li>
<li<%= sidebar_current("docs-providers-vsphere") %>> <li<%= sidebar_current("docs-providers-vsphere") %>>
<a href="/docs/providers/vsphere/index.html">vSphere</a> <a href="/docs/providers/vsphere/index.html">VMware vSphere</a>
</li> </li>
</ul> </ul>
</li> </li>

View File

@ -7,7 +7,7 @@
</li> </li>
<li<%= sidebar_current("docs-vsphere-index") %>> <li<%= sidebar_current("docs-vsphere-index") %>>
<a href="/docs/providers/vsphere/index.html">vSphere Provider</a> <a href="/docs/providers/vsphere/index.html">VMware vSphere Provider</a>
</li> </li>
<li<%= sidebar_current(/^docs-vsphere-resource/) %>> <li<%= sidebar_current(/^docs-vsphere-resource/) %>>