akamai / terraform-provider-akamai

Terraform Akamai provider
https://www.terraform.io/docs/providers/akamai/
Mozilla Public License 2.0
109 stars 95 forks source link

DXE-3816 An invalid IPv6 Address in akamai_dns_record resource triggers a stacktrace instead of a validation error #550

Open dandrucz opened 2 months ago

dandrucz commented 2 months ago

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform and Akamai Terraform Provider Versions

Run terraform -v in the directory with the .tf files to show the terraform and akamai provider versions. If you are not running the latest versions of Terraform and Akamai Terraform Provider, please upgrade because your issue may have already been fixed.

Affected Resource(s)

Please list the resources as a list, for example:

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

Terraform v1.5.7
on linux_amd64

Your version of Terraform is out of date! The latest version
is 1.8.2. You can update by downloading from https://www.terraform.io/downloads.html
+ provider registry.terraform.io/akamai/akamai v6.0.0

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist. https://gist.github.com/dandrucz/a42afdb6a9d48d12504abcb33d1a30a4

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

When fed with an incorrect IPV6 address, the code should spit out an error message that a bad IPV6 record was provided

Actual Behavior

Stacktrace and crash

Steps to Reproduce

Please list the steps required to reproduce the issue, for example: create file test.ft with data "akamai_group" "mygroup" { group_name = "mygroup" contract_id = data.akamai_contract.default.id } resource "akamai_dns_zone" "myzone" { contract = data.akamai_contract.default.id group = data.akamai_group.mygroup.id zone = "test.example.com" type = "primary" comment = Test DNS zone - Terraform Managed" sign_and_serve = false lifecycle { prevent_destroy = true } }

resource "akamai_dns_record" "metadata_host_special_ipv6_AAAA" { zone = akamai_dns_zone.myzone[0].zone name = "test.${akamai_dns_zone.myzone[0].zone}." recordtype = "AAAA" active = true ttl = 1800 target = "1111:2222:3333:4444:55555:6666:7777:8888" }

Attempt to terraform apply it, you'll get a stacktrace. instead of something more sensible like " "1111:2222:3333:4444:55555:6666:7777:8888" is not a valid IPv6 record, please check your syntax ^^^^^^^

PawelSnoch commented 2 months ago

Hello @dandrucz ,

thank you for opening this ticket. You provide an incorrect type of attribute target. It should be list of strings. Could you verify that?

Best regards, Pawel

dandrucz commented 2 months ago

Yes that was a mistake I made in filling out the report since I had to heavily sanitize the data, even with it as an array it’ll still stack trace if one of the addresses is invalid. It appears to not properly validate its input or addresses for correctness.

-- David

On May 2, 2024, at 7:49 AM, Pawel @.***> wrote:



Hello @dandruczhttps://urldefense.com/v3/__https://github.com/dandrucz__;!!GjvTz_vk!QMa40ppe-qJ0QjywemZNl3AkvILV9VFG0t5HiKZk-Ogrn_LV5qxUm-9wcq5bLsE9zyV3X9w9Lrvs4O8eAxLY3UrQ$ ,

thank you for opening this ticket. You provide an incorrect type of attribute target. It should be list of strings. Could you verify that?

Best regards, Pawel

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/akamai/terraform-provider-akamai/issues/550*issuecomment-2090305321__;Iw!!GjvTz_vk!QMa40ppe-qJ0QjywemZNl3AkvILV9VFG0t5HiKZk-Ogrn_LV5qxUm-9wcq5bLsE9zyV3X9w9Lrvs4O8eAxTBRpXL$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/BGSA42WRHZN3CNSXNXWIJPDZAIR3LAVCNFSM6AAAAABHCLTPMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJQGMYDKMZSGE__;!!GjvTz_vk!QMa40ppe-qJ0QjywemZNl3AkvILV9VFG0t5HiKZk-Ogrn_LV5qxUm-9wcq5bLsE9zyV3X9w9Lrvs4O8eA6jISmi-$. You are receiving this because you were mentioned.Message ID: @.***>

ckulinsk commented 2 months ago

Hi @dandrucz ,

Thanks for reporting this issue. We were able to reproduce it and will inform you about the progress of fix.

Best Regards, Cyryl