Commit Graph
37 Commits
Author SHA1 Message Date
Lucas Bajolet 35d14902b0 datasource/http: change Outputs->ExpectedOutputs
The acceptance tests for the HTTP datasource had a `Outputs` attribute
for checking the output of the command for a specific regexp pattern.
As pointed out, given the expectative nature of the attribute, naming it
`Outputs` did not make the intent clear, so we rename it to
`ExpectedOutputs` with this commit.
2024-11-04 15:15:30 -05:00
Lucas Bajolet c470395b7a datasource: fix test for invalid method
Since the expected error to look for in the output is compiled to a
regexp, the `[]` from the error message were interpreted as a set of
characters, which made the regexp not match the expected output from the
command.
So to avoid this problem, we escape them so they are expected verbatim
in the command output.
2024-11-04 15:15:30 -05:00
Henrik Gerdes 6c40bfb0cd feat: allow additional methods in http datasource
This adds support for additional http methods for the http datasource.
Fixes #13169

Signed-off-by: Henrik Gerdes <[email protected]>
2024-10-29 16:27:26 -04:00
Lucas Bajolet 962ccdfc80 packer: address gosimple lint errors 2024-07-18 10:51:17 -04:00
Lucas Bajolet 2009079246 packer: remove ineffasign pointed assigns/decls
Some of the variables we create are flagged by our linters as
ineffective assignments, which makes sense as those are generally fed by
code below, so we don't need to use the declaration/assignation syntax
(:=) but instead can fall back to using var with a type to get the zero
value of the declared entity.
2024-07-18 10:51:17 -04:00
Lucas Bajolet 5d43239654 datasource/http: don't error on 2xx code
When a server returns a code that is not 200, we error in the current
state.

This is not conformant to the HTTP norm, as anything in the 2xx range is
considered a success, so the datasource should not error in this case.

Therefore, this commit fixes the condition in which we report an error,
so that anything in the 2xx range is now considered a success by the
datasource.
2024-05-21 14:26:26 -04:00
3fa637c608 Migrate HCP Packer to API V2 and new nomenclature changes (#12794)
* add hcp packer new nomenclature updates

* Update docs with nomenclature changes

* Update navigation bar links

* Bump github.com/hashicorp/hcp-sdk-go from 0.81.0 to 0.82.0

* fix acceptance test template

---------

Co-authored-by: sylviamoss <[email protected]>
Co-authored-by: Wilken Rivera <[email protected]>
2024-01-24 13:17:35 -05:00
guoguangwu 7eb6a45cd4 chore: remove refs to deprecated io/ioutil
Signed-off-by: guoguangwu <[email protected]>
2023-09-26 11:13:31 -04:00
hashicorp-copywrite[bot] 19055df3ec [COMPLIANCE] License changes (#12568)
* Updating the license from MPL to Business Source License

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at https://hashi.co/license-faq, and details of the license at www.hashicorp.com/bsl.

* Update copyright file headers to BUSL-1.1

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-08-10 15:53:29 -07:00
hashicorp-copywrite[bot] b7df3ca36f [COMPLIANCE] Add Copyright and License Headers (#12254)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-03-02 15:37:05 -05:00
Lucas Bajolet 338c95b2eb datasource: remove packer-image-iteration
The `packer-image-iteration' datasource is an undocumented, and
unexported datasource, so it cannot be used by clients.

Since this is dead weight, we can remove it safely from the codebase.
2022-11-17 15:47:01 -05:00
Wilken Rivera 606e6c48f1 internal: reorganise registry/HCP code
This commit reorganises the code for both the registry/API and the
Orchestrator/Registry.

The main difference with the previous version is how stuff is exposed.
Now we only expose a Registry interface to the outside (previously named
Orchestrator), which has several implementations: null is the default,
and is returned if HCP is not enabled.

The other implementations being HCL/JSON, both private to the hcp
sub-package.

The api (previously `registry') is the set of functionality that
abstracts and calls the HCP API.
It was meant to be merged with the `hcp' package, but because of a
dependency loop with the datasources, both are separated for now.
2022-11-14 13:31:35 -05:00
Wilken Rivera 23cd26617b Update comments used by generated docs
This change updates the comments for the HCP Packer data sources to
match the recently corrected documentation text.
2022-08-09 15:42:00 -04:00
Sylvia Moss 5c3d5c1295 Send channel id to HCP Packer (#11861) 2022-07-29 15:15:29 +02:00
Shohei Maeda 9f28ced11c Add component_type optional field (#11872)
* Add `component_type` optional field

to support specifying the exact build image when multiple images exist in the same provider and region for a given iteration

* update docs

* update docs
2022-07-14 10:33:10 -07:00
Lucas Bajolet 819cc50f31 datasource: change phrasing for iteration_id
The comment was mentioning the name of an iteration Id, which is
conflicting.
This commit rephrases the comment to directly specify the ID of the
iteration.
2022-07-13 17:10:38 -04:00
Lucas Bajolet fabfc8f015 hcp-packer-image: add support for channel
In addition to the current way of specifying an image based on an
iteration on HCP Packer, which requires first declaring an iteration,
and then referencing it from the image to build, we add the capacity of
specifying a channel.

This alternative will get the iteration linked to the channel, and is
essentially a more convenient way to get an image's metadata from HCP
Packer.

This commit is essentially a backport from the Terraform HCP provider,
for consistency between the two tools.
2022-07-13 17:10:38 -04:00
Sylvia Moss b849ace27b Fail HCP datasources for revoked iteration (#11854) 2022-06-21 17:24:41 +02:00
sylviamoss 0cc754a1ad make generate 2022-05-17 20:03:49 +02:00
teddylear 805225a113 feat: add http datasource (#11658) 2022-05-17 19:26:34 +02:00
Sylvia Moss 5c0988acbd bump hcp-sdk-go and fix import path (#11763)
* bump hcp-sdk-go and fix import path

* bump hcp-sdk-go 0.19.0
2022-05-10 14:01:26 +02:00
Sylvia Moss 9ffd7ce938 Fail for revoked iterations (#11492)
* Fail for revoked iterations

* check if iteration is revoked on GetIteration

* fix fmt
2022-01-13 12:28:50 +01:00
Adrien Delorme 3278c1a817 Packer SVC acc tests (#11274) 2021-12-01 15:58:33 +01:00
Megan Marsh 8ad99a40c6 Read labels into the data source, and regenerate code. 2021-10-08 15:58:29 -07:00
Adrien Delorme 3457ed2312 Fail when an "hcp-packer-image" datasource could not be found (#11268)
* Fail when the Packer Service datasource could not be found

* Update datasource/hcp-packer-image/data.go
2021-09-15 13:53:41 +02:00
Wilken Rivera d6a5234412 Unregister packer-image-iteration datasource
This change temporarily renames the type of the packer-image-iteration
datasource to prevent it from being automatically registered by the
Packer plugin tooling. The datasource is fully functional, but not quite
ready for full usage. It will be updated in a future release.
2021-09-14 14:25:48 -04:00
Wilken Rivera b10df3abb7 Update HCP Packer registry image extraction, validation, publishing logic for registry capable plugins (#11221)
* Update handling of registry artifacts

This change uses the github.com/hashicorp/packer-plgin-sdk/packer/registryimage for querying
Artifact State for HCP Registry Image metadata. To handle the conversion
of the RPC response, mapstructure was introduced to conversion state
data into an registryimage.Image before publishing to a image bucket.

* Update to use registry image from packersdk

* Rename internal registry service pkg

* Update vendored plugins to latest version

* The latest release of Amazon, GoogleCompute, and Azure have support
  for publishing images to the HCP Packer registry.
2021-09-13 21:07:54 -04:00
Wilken Rivera 7aa6b699ab Add environment variable precheck for datasource acceptance tests (#11254)
Before change
```
=== Failed
=== FAIL: datasource/hcp-packer-iteration TestAccDatasource_HCPPackerIteration (1.97s)
    pluginacc.go:143: Error running plugin acceptance tests: Bad exit code. Logfile: packer_log_hcp_packer_iteration_datasource_basic_test.txt
        Logs can be found at /Users/wilkenrivera/Development/packer/datasource/hcp-packer-iteration/packer_log_hcp_packer_iteration_datasource_basic_test.txt
        and the acceptance test template can be found at /Users/wilkenrivera/Development/packer/datasource/hcp-packer-iteration/hcp_packer_iteration_datasource_basic_test.pkr.hcl

DONE 690 tests, 5 skipped, 1 failure in 387.912s
```

After change
```
=== SKIP: datasource/hcp-packer-iteration TestAccDatasource_HCPPackerIteration (0.00s)
    data_acc_test.go:35: Acceptance tests skipped unless envs "HCP_CLIENT_ID" and "HCP_CLIENT_SECRET" are set
```
2021-09-08 12:16:33 +02:00
Megan Marsh 48de1fc7da allow datasources to use other datasources
create a null data source for testing. We can choose to document if we want to, but it's a convenience for us

add a test to catch cyclic datasource dependency, update tests to include out of order data sources, and update the code to clean up the returned diagnostics generated from the recursive evaluation

PR review comments
2021-09-03 16:10:39 -07:00
Megan Marsh fd80f8da8c Add two new data sources -- hcp-packer-iteration and hcp-packer-image. These data sources together will allow users to query hcp_packer for the image_ids they need to use as source images to their builds, with a simple UI and clear outputs.
add quick and dirty acceptance test for hcp packer image iteration and hcp packer image data sources
PR review
linting
2021-09-03 15:51:09 -07:00
Megan Marsh 60b734733b reworked docs, and created docs page. Not adding to the website index because we don't want this doc page live until after the HCP Packer registry enters public beta 2021-08-30 16:27:08 -07:00
Megan Marsh c0eb830c42 better docstrings and regenerate docs 2021-08-30 15:53:29 -07:00
Megan Marsh 980deeb684 Implement hcp packer data source. This is a rough copy of the terraform provider's data source, to make beta user experience consistent across both sources 2021-08-27 12:03:55 -07:00
Sylvia MossandAdrien Delorme 505cbd2591 Vendor amazon plugin (#10800)
* remove amazon from core
* vendor amazon plugin
* remove website content
* Add amazon to docs-remote-plugins
* update amazon reference links in the documentation
* update amazon docs version to latest

Co-authored-by: Adrien Delorme <[email protected]>
2021-03-25 13:37:48 +01:00
Sylvia Moss d1ada744e1 Aws Secrets Manager data sources (#10505) 2021-01-22 14:49:45 +01:00
Sylvia Moss 3c7944624a (3) Add amazon-ami data source (#10467) 2021-01-20 11:05:03 +01:00
Sylvia Moss 291121dd55 (2) Implement datasources (#10440) 2021-01-20 10:37:16 +01:00