-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
docker provider additions #3761
Conversation
@@ -112,6 +117,46 @@ func resourceDockerContainerCreate(d *schema.ResourceData, meta interface{}) err | |||
hostConfig.Links = stringSetToStringSlice(v.(*schema.Set)) | |||
} | |||
|
|||
if v, ok := d.GetOk("memory"); ok { | |||
memory := int64(v.(int)) | |||
if memory > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this check, we should be able to trust that d.GetOk("memory")
will return a non-zero value, and instead put in a check for negative values into the ValidateFunc
for this schema such that obviously bad values are raised to the user.
This looks good. I added a few notes about moving some validation to |
thanks for the feedback @jen20. It all makes sense to me. Working on an update... |
|
||
if v, ok := d.GetOk("memory_swap"); ok { | ||
swap := int64(v.(int)) | ||
if swap > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1 is actually a valid value for memory_swap so I still need to check it here before converting to MBs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
LGTM now - thanks @ryane! We can merge this once the release window for 0.6.8 is finished. |
great, thanks for the update! |
provider/docker: support additional arguments for `docker_container` resource
what are the additional use cases? it looks like it just uses a different syntax to specify the number of times to attempt a restart. I don't have a strong opinion on either implementation so whatever you prefer works for me! |
Actually just looking through it I agree - I hadn't spotted the |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Adds the following functionality to the
docker_container
resource: