Skip to content
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

resource/aws_db_instance: Expose db_instance ca_cert_identifier #1256

Merged
merged 1 commit into from
Jul 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also check in the acctest that the attribute is set?


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