terraform-provider-archive icon indicating copy to clipboard operation
terraform-provider-archive copied to clipboard

archive_file: add regex to excludes

Open manasouza opened this issue 5 years ago • 7 comments

Adds basic asterisk notation regex for excludes attribute, to be able to consider files/dir prefix and suffix.

manasouza avatar Dec 21 '19 14:12 manasouza

@manasouza - I've checked the PR can you explain the below to me.

You're replacing the * with .* right? How would this work in the example of pycache from Python?

This does not work

 excludes = ["__pycache__"]

It could be done like either of these two...

 excludes = ["__pycache__/*"]
 excludes = ["./__pycache__"]

I don't believe the below code is addressing the above use case?

} else if strings.Contains(exclude, "*") {
			if matches, _ := regexp.MatchString("^"+strings.Replace(exclude, "*", ".*", -1), fileName); matches {
				return true
			}
		}

AzySir avatar Apr 08 '20 01:04 AzySir

 excludes = ["__pycache__"]
 excludes = ["__pycache__/*"]
 excludes = ["./__pycache__"]

Right. I suppose it covers all the use cases you mentioned.

Do you think is there any additional coverage needed beyond the explored by TestZipArchiver_Dir_Exclude_Prefix_Regex_With_Directory and TestZipArchiver_Dir_Exclude_Suffix_Regex_With_Directory ?

manasouza avatar Apr 08 '20 02:04 manasouza

Thank you for for the PR, @manasouza! That is very useful feature. @appilon @findkim @paultyng Could you please review it?

legal90 avatar Jun 04 '20 16:06 legal90

I've been wishing for this feature today – any chance of it being reviewed soon? 🙏

michaelbannister avatar Aug 02 '20 15:08 michaelbannister

Also wishing I had this feature today. Terragrunt creates a lot of extra files that end up in packaged resources, which change their sums. Causes erogenous re-deployments.

Being about to wildcard exclude would solve that.

tophercullen avatar Oct 23 '20 02:10 tophercullen

CLA assistant check
All committers have signed the CLA.

hashicorp-cla avatar Nov 22 '20 08:11 hashicorp-cla

I would like to know about this feature. I really wish this.

fkfouri avatar Nov 27 '21 13:11 fkfouri