Exposed aws_api_gateway_deployment.created_date attribute
This commit is contained in:
parent
1658055bfd
commit
6fb63f2854
|
@ -20,35 +20,40 @@ func resourceAwsApiGatewayDeployment() *schema.Resource {
|
||||||
Delete: resourceAwsApiGatewayDeploymentDelete,
|
Delete: resourceAwsApiGatewayDeploymentDelete,
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"rest_api_id": &schema.Schema{
|
"rest_api_id": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"stage_name": &schema.Schema{
|
"stage_name": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"description": &schema.Schema{
|
"description": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"stage_description": &schema.Schema{
|
"stage_description": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"variables": &schema.Schema{
|
"variables": {
|
||||||
Type: schema.TypeMap,
|
Type: schema.TypeMap,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
Elem: schema.TypeString,
|
Elem: schema.TypeString,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"created_date": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +83,7 @@ func resourceAwsApiGatewayDeploymentCreate(d *schema.ResourceData, meta interfac
|
||||||
d.SetId(*deployment.Id)
|
d.SetId(*deployment.Id)
|
||||||
log.Printf("[DEBUG] API Gateway Deployment ID: %s", d.Id())
|
log.Printf("[DEBUG] API Gateway Deployment ID: %s", d.Id())
|
||||||
|
|
||||||
return nil
|
return resourceAwsApiGatewayDeploymentRead(d, meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceAwsApiGatewayDeploymentRead(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsApiGatewayDeploymentRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
|
@ -97,9 +102,12 @@ func resourceAwsApiGatewayDeploymentRead(d *schema.ResourceData, meta interface{
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Printf("[DEBUG] Received API Gateway Deployment: %s", out)
|
log.Printf("[DEBUG] Received API Gateway Deployment: %s", out)
|
||||||
d.SetId(*out.Id)
|
|
||||||
d.Set("description", out.Description)
|
d.Set("description", out.Description)
|
||||||
|
|
||||||
|
if err := d.Set("created_date", out.CreatedDate.Format(time.RFC3339)); err != nil {
|
||||||
|
log.Printf("[DEBUG] Error setting created_date: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ func TestAccAWSAPIGatewayDeployment_basic(t *testing.T) {
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckAWSAPIGatewayDeploymentDestroy,
|
CheckDestroy: testAccCheckAWSAPIGatewayDeploymentDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
{
|
||||||
Config: testAccAWSAPIGatewayDeploymentConfig,
|
Config: testAccAWSAPIGatewayDeploymentConfig,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckAWSAPIGatewayDeploymentExists("aws_api_gateway_deployment.test", &conf),
|
testAccCheckAWSAPIGatewayDeploymentExists("aws_api_gateway_deployment.test", &conf),
|
||||||
|
@ -29,6 +29,8 @@ func TestAccAWSAPIGatewayDeployment_basic(t *testing.T) {
|
||||||
"aws_api_gateway_deployment.test", "description", "This is a test"),
|
"aws_api_gateway_deployment.test", "description", "This is a test"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"aws_api_gateway_deployment.test", "variables.a", "2"),
|
"aws_api_gateway_deployment.test", "variables.a", "2"),
|
||||||
|
resource.TestCheckResourceAttrSet(
|
||||||
|
"aws_api_gateway_deployment.test", "created_date"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -68,3 +68,4 @@ The following arguments are supported:
|
||||||
The following attributes are exported:
|
The following attributes are exported:
|
||||||
|
|
||||||
* `id` - The ID of the deployment
|
* `id` - The ID of the deployment
|
||||||
|
* `created_date` - The creation date of the deployment
|
||||||
|
|
Loading…
Reference in New Issue