Skip to content

Commit

Permalink
Rename rule to resp
Browse files Browse the repository at this point in the history
  • Loading branch information
shuheiktgw committed Dec 15, 2020
1 parent 5cc7321 commit c691946
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions aws/resource_aws_codestarconnections_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,20 @@ func resourceAwsCodeStarConnectionsConnectionCreate(d *schema.ResourceData, meta
ProviderType: aws.String(d.Get("provider_type").(string)),
}

res, err := conn.CreateConnection(params)
resp, err := conn.CreateConnection(params)
if err != nil {
return fmt.Errorf("error creating CodeStar connection: %w", err)
}

d.SetId(aws.StringValue(res.ConnectionArn))
d.SetId(aws.StringValue(resp.ConnectionArn))

return resourceAwsCodeStarConnectionsConnectionRead(d, meta)
}

func resourceAwsCodeStarConnectionsConnectionRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).codestarconnectionsconn

rule, err := conn.GetConnection(&codestarconnections.GetConnectionInput{
resp, err := conn.GetConnection(&codestarconnections.GetConnectionInput{
ConnectionArn: aws.String(d.Id()),
})

Expand All @@ -80,15 +80,15 @@ func resourceAwsCodeStarConnectionsConnectionRead(d *schema.ResourceData, meta i
return fmt.Errorf("error reading CodeStar connection: %s", err)
}

if rule == nil || rule.Connection == nil {
if resp == nil || resp.Connection == nil {
return fmt.Errorf("error reading CodeStar connection (%s): empty response", d.Id())
}

d.SetId(aws.StringValue(rule.Connection.ConnectionArn))
d.Set("arn", rule.Connection.ConnectionArn)
d.Set("name", rule.Connection.ConnectionName)
d.Set("connection_status", rule.Connection.ConnectionStatus)
d.Set("provider_type", rule.Connection.ProviderType)
d.SetId(aws.StringValue(resp.Connection.ConnectionArn))
d.Set("arn", resp.Connection.ConnectionArn)
d.Set("name", resp.Connection.ConnectionName)
d.Set("connection_status", resp.Connection.ConnectionStatus)
d.Set("provider_type", resp.Connection.ProviderType)

return nil
}
Expand Down

0 comments on commit c691946

Please sign in to comment.