-
Notifications
You must be signed in to change notification settings - Fork 727
Conversation
README.md
Outdated
|
||
If a exclude is defined in any place, then if will be ignored in any case. | ||
|
||
**Hint:** You can see all available resources types with this command: |
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.
resource types
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.
fixed
README.md
Outdated
a resource type must be specified in all places. In other words each | ||
configuration limits the previous ones. | ||
|
||
If a exclude is defined in any place, then if will be ignored in any case. |
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.
an exclude
it will be ignored
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.
fixed
eca2ce9
to
9617b75
Compare
bump |
README.md
Outdated
release. Eventually, every resources should get deleted. You might to restrict | ||
which resources to delete. There are multiple ways to configure this. | ||
|
||
One way are filter, which already got mentioned. This requires to know the |
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.
filters
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.
fixed
c5b1926
9617b75
to
c5b1926
Compare
pkg/types/list.go
Outdated
@@ -0,0 +1,39 @@ | |||
package types | |||
|
|||
type Set []string |
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.
Have you considered using map[string]bool
as the underlying data structure? Iterating over it would be less intuitive, but it would give a uniqueness guarantee. Possibly use a custom iterator function?
For initialization you could create a constructor which accepts []string
. That would allow making sure that the resulting set will not have duplicate entries.
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.
Using a map
also has these two downsides:
- We need a constructor, which currently isn't required (which I like).
- Since our lovely golang map gets shuffled all the time, we get non-deterministic results (ie resources get nuked in a different order every time).
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.
Valid points. It feels rather odd though to have a data structure called "set", which does not adhere to the properties of a set.
If I am not mistaken, Set{"foo", "foo"}.Remove(Set{"foo"})
would return Set{"foo"}
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.
With the current implementation it would remove both.
I am not eager to implement something just to match a name. We can rename it, if you suggest a better name.
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.
Oh yeah, you are totally right, it would remove both. Sorry about that.
Hmm..., naming things is hard ... how about LazySet
. What do you think? It would imply it is not quite a super strict set but it certainly is a set. Feel free to stick with Set
if you prefer.
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.
"lazy" always makes me think of lazy loading. What about Collection
to remove any implication from the name?
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.
Good idea! I like it.
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.
renamed
pkg/types/list.go
Outdated
} | ||
|
||
func (s Set) Union(o Set) Set { | ||
return Set(append(s, o...)) |
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.
This would create duplicate entries in the set. Do you actually need it?
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.
feixd
pkg/types/list.go
Outdated
@@ -0,0 +1,39 @@ | |||
package types |
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.
I would probably call it set.go
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.
fiexd
config/example.yaml
Outdated
@@ -4,8 +4,18 @@ regions: | |||
account-blacklist: | |||
- 1234567890 | |||
|
|||
resource-types: | |||
target: |
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.
Consider having two examples, one with a blacklist and another one with a whitelist.
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.
fxeid
cmd/config.go
Outdated
"gopkg.in/yaml.v2" | ||
) | ||
|
||
type ResourceConfig struct { | ||
Targets types.Set `yaml:"targets"` | ||
Excludes types.Set `yaml:"excludes"` |
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.
Shouldn't this be yaml:"target"
and yaml:"exclude"
?
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.
IMO not, since you specify a list.
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.
Makes sense. Doesn't this need to be targets
: https://github.com/rebuy-de/aws-nuke/pull/74/files#diff-04c6e90faac2675aa89e2176d2eec7d8R223 ?
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.
fexid
README.md
Outdated
a resource type must be specified in all places. In other words each | ||
configuration limits the previous ones. | ||
|
||
If an exclude is defined in any place, then it will be ignored in any case. |
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.
Consider being more explicit, along the lines of:
If an exclude is used, then all its resource types will not be deleted.
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.
fxied
c5b1926
to
0666932
Compare
bump |
README.md
Outdated
### Specifying Resource Types to Delete | ||
|
||
*aws-nuke* deletes a lot of resources and there might be added more at any | ||
release. Eventually, every resources should get deleted. You might to restrict |
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.
"you might want to restrict" ?
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.
fixed
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.
👍
2983cd5
to
4629ded
Compare
e10612e
to
88419ca
Compare
Unlike proposed in #54, I let the flag named
--target
. I think my confusion about union and intersection came from the flag name. By naming the flag target it should be more clear how it behaves.Also I updated the command line flag descriptions.
@rebuy-de/prp-aws-nuke Please review.