Export RDS instance and cluster resource id (#14882)

This commit is contained in:
Jeff Theriault 2017-05-27 23:47:55 -06:00 committed by Radek Simko
parent 85f2d10e9f
commit 07f89e2728
6 changed files with 18 additions and 0 deletions

View File

@ -340,6 +340,11 @@ func resourceAwsDbInstance() *schema.Resource {
Optional: true, Optional: true,
}, },
"resource_id": {
Type: schema.TypeString,
Computed: true,
},
"tags": tagsSchema(), "tags": tagsSchema(),
}, },
} }
@ -701,6 +706,7 @@ func resourceAwsDbInstanceRead(d *schema.ResourceData, meta interface{}) error {
d.Set("name", v.DBName) d.Set("name", v.DBName)
d.Set("identifier", v.DBInstanceIdentifier) d.Set("identifier", v.DBInstanceIdentifier)
d.Set("resource_id", v.DbiResourceId)
d.Set("username", v.MasterUsername) d.Set("username", v.MasterUsername)
d.Set("engine", v.Engine) d.Set("engine", v.Engine)
d.Set("engine_version", v.EngineVersion) d.Set("engine_version", v.EngineVersion)

View File

@ -47,6 +47,8 @@ func TestAccAWSDBInstance_basic(t *testing.T) {
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"aws_db_instance.bar", "parameter_group_name", "default.mysql5.6"), "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", "hosted_zone_id"),
resource.TestCheckResourceAttrSet(
"aws_db_instance.bar", "resource_id"),
), ),
}, },
}, },

View File

@ -227,6 +227,11 @@ func resourceAwsRDSCluster() *schema.Resource {
Optional: true, Optional: true,
}, },
"cluster_resource_id": {
Type: schema.TypeString,
Computed: true,
},
"tags": tagsSchema(), "tags": tagsSchema(),
}, },
} }
@ -523,6 +528,7 @@ func resourceAwsRDSClusterRead(d *schema.ResourceData, meta interface{}) error {
} }
d.Set("cluster_identifier", dbc.DBClusterIdentifier) d.Set("cluster_identifier", dbc.DBClusterIdentifier)
d.Set("cluster_resource_id", dbc.DbClusterResourceId)
d.Set("db_subnet_group_name", dbc.DBSubnetGroup) d.Set("db_subnet_group_name", dbc.DBSubnetGroup)
d.Set("db_cluster_parameter_group_name", dbc.DBClusterParameterGroup) d.Set("db_cluster_parameter_group_name", dbc.DBClusterParameterGroup)
d.Set("endpoint", dbc.Endpoint) d.Set("endpoint", dbc.Endpoint)

View File

@ -34,6 +34,8 @@ func TestAccAWSRDSCluster_basic(t *testing.T) {
"aws_rds_cluster.default", "db_cluster_parameter_group_name", "default.aurora5.6"), "aws_rds_cluster.default", "db_cluster_parameter_group_name", "default.aurora5.6"),
resource.TestCheckResourceAttrSet( resource.TestCheckResourceAttrSet(
"aws_rds_cluster.default", "reader_endpoint"), "aws_rds_cluster.default", "reader_endpoint"),
resource.TestCheckResourceAttrSet(
"aws_rds_cluster.default", "cluster_resource_id"),
), ),
}, },
}, },

View File

@ -126,6 +126,7 @@ standalone database.
The following attributes are exported: The following attributes are exported:
* `id` - The RDS instance ID. * `id` - The RDS instance ID.
* `resource_id` - The RDS Resource ID of this instance.
* `address` - The address of the RDS instance. * `address` - The address of the RDS instance.
* `arn` - The ARN of the RDS instance. * `arn` - The ARN of the RDS instance.
* `allocated_storage` - The amount of allocated storage * `allocated_storage` - The amount of allocated storage

View File

@ -91,6 +91,7 @@ The following attributes are exported:
* `id` - The RDS Cluster Identifier * `id` - The RDS Cluster Identifier
* `cluster_identifier` - The RDS Cluster Identifier * `cluster_identifier` - The RDS Cluster Identifier
* `cluster_resource_id` - The RDS Cluster Resource ID
* `cluster_members`  List of RDS Instances that are a part of this cluster * `cluster_members`  List of RDS Instances that are a part of this cluster
* `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