Skip to content

[package-spec] - Added support for '*.csv' and '*.gz' file patterns in terraform deployer spec #926

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

Merged
merged 3 commits into from
Jul 14, 2025

Conversation

ShourieG
Copy link
Contributor

@ShourieG ShourieG commented Jul 11, 2025

What does this PR do?

Adds support for '.csv' and '.gz' file patterns in terraform deployer spec.

Why is it important?

Unblocks integration PRs which utilise such patterns.

Checklist

Related issues

@ShourieG ShourieG self-assigned this Jul 11, 2025
@ShourieG ShourieG added enhancement New feature or request impact:high Short-term priority; add to current release, or definitely next. Team:Ecosystem Label for the Packages Ecosystem team labels Jul 11, 2025
@ShourieG ShourieG marked this pull request as ready for review July 11, 2025 07:43
@ShourieG ShourieG requested a review from a team as a code owner July 11, 2025 07:44
@ShourieG ShourieG requested a review from jsoriano July 11, 2025 07:45
Comment on lines 7 to 9
- description: Added support for '*.csv' and '*.gz' file patterns in terraform deployer spec.
type: enhancement
link: https://github.com/elastic/package-spec/pull/926
Copy link
Contributor

Choose a reason for hiding this comment

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

This changelog entry can be moved to 3.4.1-next version section.

Comment on lines 23 to 26
- description: Csv files to add into terraform resources
type: file
pattern: '^.*\.csv$'
required: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Could it be added text/plain as content media type ?

Suggested change
- description: Csv files to add into terraform resources
type: file
pattern: '^.*\.csv$'
required: false
- description: Csv files to add into terraform resources
type: file
contentMediaType: "text/plain"
pattern: '^.*\.csv$'
required: false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mime type for csv is text/csv, would that suit better here ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, you're right that would suit better.

Currently, text/csv mime type is not supported in package-spec:

func validateContentType(fsys fs.FS, path string, contentType spectypes.ContentType) error {
switch contentType.MediaType {
case "application/x-yaml":
v, _ := contentType.Params["require-document-dashes"]
requireDashes := (v == "true")
if requireDashes {
err := validateYAMLDashes(fsys, path)
if err != nil {
return err
}
}
case "application/json":
case "text/markdown":
case "text/plain":
default:
return fmt.Errorf("unsupported media type (%s)", contentType)
}
return nil
}

One option is to add another case for text/csv into that function (as it is text/markdown or text/plain) for instance. And I guess it is not needed to add any specific validation for that media type.

@ShourieG
Copy link
Contributor Author

@mrodm, made the suggested changes

@elasticmachine
Copy link

💚 Build Succeeded

History

cc @ShourieG

@ShourieG ShourieG requested a review from mrodm July 11, 2025 18:54
@moxarth-rathod
Copy link

@ShourieG another related PR elastic/integrations#14524.

@ShourieG
Copy link
Contributor Author

@mrodm, I'm not getting the option to merge, can you help me to get it merged.

@mrodm
Copy link
Contributor

mrodm commented Jul 14, 2025

@mrodm, I'm not getting the option to merge, can you help me to get it merged.

Sure, I'll merge it 👍

@mrodm mrodm merged commit 37e88fb into elastic:main Jul 14, 2025
3 checks passed
@ShourieG ShourieG deleted the #925/add_patterns branch July 21, 2025 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request impact:high Short-term priority; add to current release, or definitely next. Team:Ecosystem Label for the Packages Ecosystem team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Change Proposal] - Add support for more file types in terraform deployer
4 participants