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

feature: Add working_directory to ImageBuilder #16947

Merged
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
5 changes: 5 additions & 0 deletions aws/data_source_aws_imagebuilder_image_recipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ func dataSourceAwsImageBuilderImageRecipe() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"working_directory": {
Copy link
Contributor

Choose a reason for hiding this comment

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

This new attribute needs documentation added in websites/docs/d/imagebuilder_image_recipe.html.markdown -- will followup on merge.

Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -154,6 +158,7 @@ func dataSourceAwsImageBuilderImageRecipeRead(d *schema.ResourceData, meta inter
d.Set("platform", imageRecipe.Platform)
d.Set("tags", keyvaluetags.ImagebuilderKeyValueTags(imageRecipe.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map())
d.Set("version", imageRecipe.Version)
d.Set("working_directory", imageRecipe.WorkingDirectory)

return nil
}
1 change: 1 addition & 0 deletions aws/data_source_aws_imagebuilder_image_recipe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ resource "aws_imagebuilder_component" "test" {
}]
schemaVersion = 1.0
})
working_directory = "/tmp"
Copy link
Contributor

Choose a reason for hiding this comment

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

Per the Contributing Guide, it is preferred to have new optional arguments in new, separate acceptance tests. Will followup these commits adding a resource test and refactoring this data source test.

name = %[1]q
platform = "Linux"
version = "1.0.0"
Expand Down
10 changes: 10 additions & 0 deletions aws/resource_aws_imagebuilder_image_recipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ func resourceAwsImageBuilderImageRecipe() *schema.Resource {
ForceNew: true,
ValidateFunc: validation.StringLenBetween(1, 128),
},
"working_directory": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringLenBetween(1, 1024),
},
},
}
}
Expand Down Expand Up @@ -208,6 +214,9 @@ func resourceAwsImageBuilderImageRecipeCreate(d *schema.ResourceData, meta inter
if v, ok := d.GetOk("version"); ok {
input.SemanticVersion = aws.String(v.(string))
}
if v, ok := d.GetOk("working_directory"); ok {
input.WorkingDirectory = aws.String(v.(string))
}

output, err := conn.CreateImageRecipe(input)

Expand Down Expand Up @@ -261,6 +270,7 @@ func resourceAwsImageBuilderImageRecipeRead(d *schema.ResourceData, meta interfa
d.Set("platform", imageRecipe.Platform)
d.Set("tags", keyvaluetags.ImagebuilderKeyValueTags(imageRecipe.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map())
d.Set("version", imageRecipe.Version)
d.Set("working_directory", imageRecipe.WorkingDirectory)

return nil
}
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/imagebuilder_image_recipe.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ The following attributes are optional:
* `block_device_mapping` - (Optional) Configuration block(s) with block device mappings for the the image recipe. Detailed below.
* `description` - (Optional) Description of the image recipe.
* `tags` - (Optional) Key-value map of resource tags for the image recipe.
* `working_directory` - (Optional) The working directory to be used during build and test workflows.

### block_device_mapping

Expand Down