Merge pull request #3139 from koendc/b-rds-snapshots-required-fields
provider/aws: aws_db_instance: make some fields optional
This commit is contained in:
commit
eed2a2a0f6
|
@ -38,18 +38,20 @@ func resourceAwsDbInstance() *schema.Resource {
|
|||
|
||||
"username": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
|
||||
"password": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Optional: true,
|
||||
},
|
||||
|
||||
"engine": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ForceNew: true,
|
||||
StateFunc: func(v interface{}) string {
|
||||
value := v.(string)
|
||||
|
@ -71,7 +73,8 @@ func resourceAwsDbInstance() *schema.Resource {
|
|||
|
||||
"allocated_storage": &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
"storage_type": &schema.Schema{
|
||||
|
@ -405,6 +408,18 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error
|
|||
|
||||
}
|
||||
} else {
|
||||
if _, ok := d.GetOk("allocated_storage"); !ok {
|
||||
return fmt.Errorf(`provider.aws: aws_db_instance: %s: "allocated_storage": required field is not set`, d.Get("name").(string))
|
||||
}
|
||||
if _, ok := d.GetOk("engine"); !ok {
|
||||
return fmt.Errorf(`provider.aws: aws_db_instance: %s: "engine": required field is not set`, d.Get("name").(string))
|
||||
}
|
||||
if _, ok := d.GetOk("password"); !ok {
|
||||
return fmt.Errorf(`provider.aws: aws_db_instance: %s: "password": required field is not set`, d.Get("name").(string))
|
||||
}
|
||||
if _, ok := d.GetOk("username"); !ok {
|
||||
return fmt.Errorf(`provider.aws: aws_db_instance: %s: "username": required field is not set`, d.Get("name").(string))
|
||||
}
|
||||
opts := rds.CreateDBInstanceInput{
|
||||
AllocatedStorage: aws.Int64(int64(d.Get("allocated_storage").(int))),
|
||||
DBName: aws.String(d.Get("name").(string)),
|
||||
|
|
|
@ -48,8 +48,8 @@ the [AWS official documentation](http://docs.aws.amazon.com/AmazonRDS/latest/Com
|
|||
|
||||
The following arguments are supported:
|
||||
|
||||
* `allocated_storage` - (Required) The allocated storage in gigabytes.
|
||||
* `engine` - (Required) The database engine to use.
|
||||
* `allocated_storage` - (Required unless a `snapshot_identifier` or `replicate_source_db` is provided) The allocated storage in gigabytes.
|
||||
* `engine` - (Required unless a `snapshot_identifier` or `replicate_source_db` is provided) The database engine to use.
|
||||
* `engine_version` - (Optional) The engine version to use.
|
||||
* `identifier` - (Required) The name of the RDS instance
|
||||
* `instance_class` - (Required) The instance type of the RDS instance.
|
||||
|
@ -65,9 +65,9 @@ the final snapshot (if `final_snapshot_identifier` is specified). Default
|
|||
`false`
|
||||
* `name` - (Optional) The DB name to create. If omitted, no database is created
|
||||
initially.
|
||||
* `password` - (Required) Password for the master DB user. Note that this may
|
||||
* `password` - (Required unless a `snapshot_identifier` or `replicate_source_db` is provided) Password for the master DB user. Note that this may
|
||||
show up in logs, and it will be stored in the state file.
|
||||
* `username` - (Required) Username for the master DB user.
|
||||
* `username` - (Required unless a `snapshot_identifier` or `replicate_source_db` is provided) Username for the master DB user.
|
||||
* `availability_zone` - (Optional) The AZ for the RDS instance.
|
||||
* `backup_retention_period` - (Optional) The days to retain backups for. Must be
|
||||
`1` or greater to be a source for a [Read Replica][1].
|
||||
|
|
Loading…
Reference in New Issue