DrFaust92 / terraform-provider-bitbucket

Terraform Bitbucket Cloud provider.
https://registry.terraform.io/providers/drfaust92/bitbucket
Mozilla Public License 2.0
38 stars 30 forks source link

fix(kown_host) allowed public key type values #72

Closed Nkmol closed 2 years ago

Nkmol commented 2 years ago

This PR fixes the input validation for the public_key.key_type to work with values Bitbucket actually use for their known host entities.

The values have been retrieved by using the /pipelines_config/ssh/known_hosts/?pagelen=100 endpoint. Where the added known host is tested with an correct SSH pipeline connection.


Fixes #70

DrFaust92 commented 2 years ago

Hi @Nkmol looks great, can you run accpetance tests and share results?

DrFaust92 commented 2 years ago

output from tests (from branch):

--- PASS: TestAccBitbucketPipelineSshKnownHost_basic (12.63s)
Nkmol commented 2 years ago

@DrFaust92 Thanks for this! Note that the current acceptance tests do not test much, as the Atlassian API simply accepts any input as long as it is a string 🤷

If I add a new type in the tests called "rsa-blablabla" and run the acceptance tests:

BITBUCKET_USERNAME=${username} BITBUCKET_PASSWORD=${app_password} BITBUCKET_TEAM=${workspace} TF_ACC=1 go test github.com/terraform-providers/terraform-provider-bitbucket/bitbucket -v -run '^TestAccBitbucketPipelineSshKnownHost_basic'

I still get a “OK” 😅


Speaking of this, I come across the last problem that is the last bit to make this resource completely useful: https://github.com/DrFaust92/terraform-provider-bitbucket/issues/76