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

[Draft PR - Do Not Merge] jkroepke:tar.gz - Acceptance Testing #353

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
140df95
Add format tar.gz
jkroepke Nov 21, 2023
e80dec4
Merge branch 'main' into tar.gz
jkroepke Dec 25, 2023
9535b84
Merge branch 'main' into tar.gz
jkroepke Feb 4, 2024
e6ca442
Merge branch 'main' into tar.gz
jkroepke Feb 11, 2024
00ebf19
add doc note
jkroepke Feb 11, 2024
4ffb00b
Merge branch 'main' into tar.gz
jkroepke Mar 10, 2024
9d07f68
Merge branch 'main' into tar.gz
jkroepke Mar 17, 2024
f0daab2
Merge branch 'main' into tar.gz
jkroepke Mar 24, 2024
9f9155e
fix: inconsistent output with multiple files
jkroepke May 10, 2024
6dd7a57
Merge branch 'main' into tar.gz
jkroepke May 10, 2024
e180e32
Merge branch 'main' into tar.gz
jkroepke May 30, 2024
6c36f7d
Merge branch 'main' into tar.gz
SBGoods Jul 22, 2024
d3a8956
fix lint issues
jkroepke Jul 22, 2024
24be5b0
Regenerate provider documentation
SBGoods Jul 22, 2024
0af3509
fix: stabilize checksum in data resource for directories
jkroepke Jul 22, 2024
2af360b
fix: nil pointer in tests
jkroepke Jul 22, 2024
29d709a
fix: tests
jkroepke Jul 23, 2024
0a6c04f
fix: tests
jkroepke Jul 23, 2024
5943e85
Close gzip reader
SBGoods Jul 23, 2024
2c39a60
fix windows issues
jkroepke Jul 30, 2024
df4b3a5
Merge branch 'main' into tar.gz
SBGoods Jul 30, 2024
165dd3a
Add format tar.gz
jkroepke Nov 21, 2023
487bc5e
add doc note
jkroepke Feb 11, 2024
e10f496
fix: inconsistent output with multiple files
jkroepke May 10, 2024
48711a3
fix lint issues
jkroepke Jul 22, 2024
958ea4e
Regenerate provider documentation
SBGoods Jul 22, 2024
f2abe37
fix: stabilize checksum in data resource for directories
jkroepke Jul 22, 2024
01de7bd
fix: nil pointer in tests
jkroepke Jul 22, 2024
5a0b9eb
fix: tests
jkroepke Jul 23, 2024
c3eeece
fix: tests
jkroepke Jul 23, 2024
cf1a5d6
Close gzip reader
SBGoods Jul 23, 2024
93506c9
fix windows issues
jkroepke Jul 30, 2024
9fc8a64
fix: conflicts
jkroepke Jul 30, 2024
ec0ede2
Update internal/provider/tar_archiver_test.go
jkroepke Aug 5, 2024
4847d78
test: move assert out of loop
jkroepke Aug 5, 2024
41187d3
test: remove unused var
jkroepke Aug 5, 2024
f3c9eb3
Update internal/provider/tar_archiver_test.go
jkroepke Aug 5, 2024
cb4cec2
test: add ensureTarContents to TestTarArchiver_Dir_Exclude_ExcludeSym…
jkroepke Aug 5, 2024
da59316
rebase from main
jkroepke Aug 5, 2024
3fefca5
split tests
jkroepke Aug 5, 2024
85ea3f1
Merge remote-tracking branch 'origin/SBGoods/tar.gz' into SBGoods/tar.gz
SBGoods Aug 5, 2024
5d66d18
remove duplicate tests
jkroepke Aug 5, 2024
8e2f59f
Merge branch 'refs/heads/tar.gz' into SBGoods/tar.gz
SBGoods Aug 5, 2024
0bb5f6e
Fix `TestAccTarGzArchiveFile_SourceConfigConflicting()` acceptance test
SBGoods Aug 6, 2024
8cb3a53
Add changelog entries
SBGoods Aug 6, 2024
79a2935
Merge branch 'refs/heads/main' into tar.gz
SBGoods Aug 6, 2024
ddedf0b
Merge branch 'refs/heads/tar.gz' into SBGoods/tar.gz
SBGoods Aug 6, 2024
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 .changes/unreleased/FEATURES-20240806-142303.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: FEATURES
body: 'data-source/archive_file: Add support for creating `tar.gz` archive files.'
time: 2024-08-06T14:23:03.200664-04:00
custom:
Issue: "277"
5 changes: 5 additions & 0 deletions .changes/unreleased/FEATURES-20240806-142529.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: FEATURES
body: 'resource/archive_file: Add support for creating `tar.gz` archive files.'
time: 2024-08-06T14:25:29.318873-04:00
custom:
Issue: "277"
2 changes: 1 addition & 1 deletion docs/data-sources/file.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ data "archive_file" "lambda_my_function" {
### Required

- `output_path` (String) The output of the archive file.
- `type` (String) The type of archive to generate. NOTE: `zip` is supported.
- `type` (String) The type of archive to generate. NOTE: `zip` and `tar.gz` is supported.

### Optional

Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0
github.com/hashicorp/terraform-plugin-go v0.23.0
github.com/hashicorp/terraform-plugin-testing v1.9.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
)

require (
Expand Down Expand Up @@ -54,12 +55,12 @@ require (
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zclconf/go-cty v1.14.4 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
golang.org/x/tools v0.23.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/grpc v1.63.2 // indirect
Expand Down
14 changes: 8 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,17 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8=
golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -204,8 +206,8 @@ golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
Expand Down
15 changes: 9 additions & 6 deletions internal/provider/archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ type Archiver interface {
type ArchiverBuilder func(outputPath string) Archiver

var archiverBuilders = map[string]ArchiverBuilder{
"zip": NewZipArchiver,
"zip": NewZipArchiver,
"tar.gz": NewTarGzArchiver,
}

func getArchiver(archiveType string, outputPath string) Archiver {
Expand All @@ -42,16 +43,18 @@ func assertValidFile(infilename string) (os.FileInfo, error) {
return fi, err
}

func assertValidDir(indirname string) (os.FileInfo, error) {
func assertValidDir(indirname string) error {
fi, err := os.Stat(indirname)
if err != nil {
if os.IsNotExist(err) {
return fi, fmt.Errorf("could not archive missing directory: %s", indirname)
return fmt.Errorf("could not archive missing directory: %s", indirname)
}
return fi, err
return err
}

if !fi.IsDir() {
return fi, fmt.Errorf("could not archive directory that is a file: %s", indirname)
return fmt.Errorf("could not archive directory that is a file: %s", indirname)
}
return fi, nil

return nil
}
2 changes: 1 addition & 1 deletion internal/provider/data_source_archive_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (d *archiveFileDataSource) Schema(ctx context.Context, req datasource.Schem
Computed: true,
},
"type": schema.StringAttribute{
Description: "The type of archive to generate. NOTE: `zip` is supported.",
Description: "The type of archive to generate. NOTE: `zip` and `tar.gz` is supported.",
Required: true,
},
"source_content": schema.StringAttribute{
Expand Down
Loading
Loading