Skip to content

Commit

Permalink
Merge pull request #1256 from stack72/b-aws-db-instance-cacert-1166
Browse files Browse the repository at this point in the history
resource/aws_db_instance: Expose db_instance ca_cert_identifier
  • Loading branch information
Ninir authored Jul 31, 2017
2 parents 1301e20 + d46ead3 commit d12efee
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions aws/data_source_aws_db_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ func dataSourceAwsDbInstance() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},

"ca_cert_identifier": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -277,6 +282,7 @@ func dataSourceAwsDbInstanceRead(d *schema.ResourceData, meta interface{}) error
d.Set("storage_type", dbInstance.StorageType)
d.Set("timezone", dbInstance.Timezone)
d.Set("replicate_source_db", dbInstance.ReadReplicaSourceDBInstanceIdentifier)
d.Set("ca_cert_identifier", dbInstance.CACertificateIdentifier)

var vpcSecurityGroups []string
for _, v := range dbInstance.VpcSecurityGroups {
Expand Down
8 changes: 7 additions & 1 deletion aws/resource_aws_db_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,11 @@ func resourceAwsDbInstance() *schema.Resource {
Computed: true,
},

"ca_cert_identifier": {
Type: schema.TypeString,
Computed: true,
},

"tags": tagsSchema(),
},
}
Expand Down Expand Up @@ -815,7 +820,6 @@ func resourceAwsDbInstanceRead(d *schema.ResourceData, meta interface{}) error {
sgn.Add(*v.DBSecurityGroupName)
}
d.Set("security_group_names", sgn)

// replica things

var replicas []string
Expand All @@ -828,6 +832,8 @@ func resourceAwsDbInstanceRead(d *schema.ResourceData, meta interface{}) error {

d.Set("replicate_source_db", v.ReadReplicaSourceDBInstanceIdentifier)

d.Set("ca_cert_identifier", v.CACertificateIdentifier)

return nil
}

Expand Down
1 change: 1 addition & 0 deletions aws/resource_aws_db_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func TestAccAWSDBInstance_basic(t *testing.T) {
resource.TestCheckResourceAttr(
"aws_db_instance.bar", "parameter_group_name", "default.mysql5.6"),
resource.TestCheckResourceAttrSet("aws_db_instance.bar", "hosted_zone_id"),
resource.TestCheckResourceAttrSet("aws_db_instance.bar", "ca_cert_identifier"),
resource.TestCheckResourceAttrSet(
"aws_db_instance.bar", "resource_id"),
),
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/db_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ The following attributes are exported:
* `timezone` - The time zone of the DB instance.
* `vpc_security_groups` - Provides a list of VPC security group elements that the DB instance belongs to.
* `replicate_source_db` - The identifier of the source DB that this is a replica of.
* `ca_cert_identifier` - Specifies the identifier of the CA certificate for the DB instance.
1 change: 1 addition & 0 deletions website/docs/r/db_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ The following attributes are exported:
* `username` - The master username for the database
* `storage_encrypted` - Specifies whether the DB instance is encrypted
* `hosted_zone_id` - The canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record)
* `ca_cert_identifier` - Specifies the identifier of the CA certificate for the DB instance.

On Oracle instances the following is exported additionally:

Expand Down

0 comments on commit d12efee

Please sign in to comment.