Skip to content

Commit

Permalink
corrections based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
saravanan30erd committed Jun 18, 2018
1 parent 05c3a3c commit 2764126
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 22 deletions.
20 changes: 8 additions & 12 deletions aws/resource_aws_neptune_cluster_parameter_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"log"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/service/neptune"

"github.com/hashicorp/terraform/helper/resource"
Expand Down Expand Up @@ -108,14 +107,16 @@ func resourceAwsNeptuneClusterParameterGroupCreate(d *schema.ResourceData, meta
}

log.Printf("[DEBUG] Create Neptune Cluster Parameter Group: %#v", createOpts)
_, err := conn.CreateDBClusterParameterGroup(&createOpts)
resp, err := conn.CreateDBClusterParameterGroup(&createOpts)
if err != nil {
return fmt.Errorf("Error creating Neptune Cluster Parameter Group: %s", err)
}

d.SetId(aws.StringValue(createOpts.DBClusterParameterGroupName))
log.Printf("[INFO] Neptune Cluster Parameter Group ID: %s", d.Id())

d.Set("arn", resp.DBClusterParameterGroup.DBClusterParameterGroupArn)

return resourceAwsNeptuneClusterParameterGroupUpdate(d, meta)
}

Expand All @@ -137,9 +138,10 @@ func resourceAwsNeptuneClusterParameterGroupRead(d *schema.ResourceData, meta in
return err
}

if len(describeResp.DBClusterParameterGroups) != 1 ||
aws.StringValue(describeResp.DBClusterParameterGroups[0].DBClusterParameterGroupName) != d.Id() {
return fmt.Errorf("Unable to find Cluster Parameter Group: %#v", describeResp.DBClusterParameterGroups)
if len(describeResp.DBClusterParameterGroups) == 0 {
log.Printf("[WARN] Neptune Cluster Parameter Group (%s) not found, removing from state", d.Id())
d.SetId("")
return nil
}

d.Set("name", describeResp.DBClusterParameterGroups[0].DBClusterParameterGroupName)
Expand Down Expand Up @@ -225,13 +227,7 @@ func resourceAwsNeptuneClusterParameterGroupUpdate(d *schema.ResourceData, meta
}
}

arn := arn.ARN{
Partition: meta.(*AWSClient).partition,
Service: "rds",
Region: meta.(*AWSClient).region,
AccountID: meta.(*AWSClient).accountid,
Resource: fmt.Sprintf("cluster-pg:%s", d.Id()),
}.String()
arn := d.Get("arn").(string)
if err := setTagsNeptune(conn, d, arn); err != nil {
return err
} else {
Expand Down
2 changes: 2 additions & 0 deletions aws/resource_aws_neptune_cluster_parameter_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ func TestAccAWSNeptuneClusterParameterGroup_basic(t *testing.T) {
resource.TestCheckResourceAttr("aws_neptune_cluster_parameter_group.bar", "parameter.#", "1"),
resource.TestCheckResourceAttr(
"aws_neptune_cluster_parameter_group.bar", "tags.%", "1"),
resource.TestMatchResourceAttr(
"aws_neptune_cluster_parameter_group.bar", "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:rds:[^:]+:\\d{12}:cluster-pg:%s", parameterGroupName))),
),
},
},
Expand Down
14 changes: 4 additions & 10 deletions website/aws.erb
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,10 @@
<a href="/docs/providers/aws/r/neptune_subnet_group.html">aws_neptune_subnet_group</a>
</li>

<li<%= sidebar_current("docs-aws-resource-neptune-cluster-parameter-group") %>>
<a href="/docs/providers/aws/r/neptune_cluster_parameter_group.html">aws_neptune_cluster_parameter_group</a>
</li>

</ul>
</li>

Expand All @@ -1647,16 +1651,6 @@
<li<%= sidebar_current("docs-aws-resource-redshift-subnet-group") %>>
<a href="/docs/providers/aws/r/redshift_subnet_group.html">aws_redshift_subnet_group</a>
</li>
<li<%= sidebar_current("docs-aws-resource-neptune") %>>
<a href="#">Neptune Resources</a>
<ul class="nav nav-visible">

<li<%= sidebar_current("docs-aws-resource-aws-neptune-parameter-group") %>>
<a href="/docs/providers/aws/r/neptune_parameter_group.html">aws_neptune_parameter_group</a>
</li>

</ul>
</li>

</ul>
</li>
Expand Down

0 comments on commit 2764126

Please sign in to comment.