F5Networks / terraform-provider-bigip

Terraform resources that can configure F5 BIG-IP products
https://registry.terraform.io/providers/F5Networks/bigip/latest/docs
Mozilla Public License 2.0
103 stars 119 forks source link

bigip_ssl_certificate and bigip_ssl_key size limitation? #1008

Closed Gabriel-Canton closed 1 month ago

Gabriel-Canton commented 1 month ago

Environment

Creation of resources of type bigip_ssl_certificate and bigip_ssl_key (same goes for bigip_ssl_certificate_key) fails with errors like: │ Error: error in Importing certificate (hynet.crt): json: cannot unmarshal number 1723388253466977 into Go struct field Upload.lastUpdateMicros of type int.

I think it may have to do with the key size and/or any cryptography parameters that affect the lenght of the crt and key files, because the error doesn't occur with smaller files.

This limits the utility of the provider and looks like an easy one to fix.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Provide terraform resource config which you are facing trouble along with the output of it.
    
    $ cat main.tf
    terraform {
    required_providers {
    bigip = {
      source = "F5Networks/bigip"
      version = ">=1.22.3"
    }
    }
    }
    variable "BIGIP_ADDRESS_ACTIVE" {
    type = string
    }
    variable "ADMIN_PASSWORD_ACTIVE" {
    type = string
    }

provider "bigip" { address = "${var.BIGIP_ADDRESS_ACTIVE}" username = "admin" password = "${var.ADMIN_PASSWORD_ACTIVE}" }

resource "bigip_ssl_certificate" "cert_1" { name = "hynet.crt" content = file("wildcard.afg.corp.crt") partition = "Common" }

resource "bigip_ssl_key" "key_1" { name = "hynet.key" content = file ("wildcard.afg.corp.key") partition = "Common" }

$ terraform.exe apply

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:

Terraform will perform the following actions:

bigip_ssl_certificate.cert_1 will be created

Plan: 2 to add, 0 to change, 0 to destroy.

Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve.

Enter a value: yes

bigip_ssl_key.key_1: Creating... bigip_ssl_certificate.cert_1: Creating... ╷ │ Error: error in Importing certificate (hynet.crt): json: cannot unmarshal number 1723388253466977 into Go struct field Upload.lastUpdateMicros of type int │ │ with bigip_ssl_certificate.cert_1, │ on main.tf line 22, in resource "bigip_ssl_certificate" "cert_1": │ 22: resource "bigip_ssl_certificate" "cert_1" { │ ╵ ╷ │ Error: error in Uploading certificate key (hynet.key): json: cannot unmarshal number 1723388253457100 into Go struct field Upload.lastUpdateMicros of type int │ │ with bigip_ssl_key.key_1, │ on main.tf line 28, in resource "bigip_ssl_key" "key_1": │ 28: resource "bigip_ssl_key" "key_1" { │


2. To get to know more about the issue, provide terraform debug logs
[debug_log.txt](https://github.com/user-attachments/files/16574131/debug_log.txt)

3. To capture debug logs, export TF_LOG variable with debug ( export TF_LOG= DEBUG ) before 
  runnning terraform apply/plan

4. As3/DO json along with the resource config( for AS3/DO resource issues )

### Expected Behavior
A clear and concise description of what you expected to happen.

Resources should be created.

### Actual Behavior
A clear and concise description of what actually happens.
Please include any applicable error output.
Apply fails, resources are not created. See above
Gabriel-Canton commented 1 month ago

Well, apparently it was the terraform executable. I was using the 386 version instead of the AMD64. The names are a bit confusing IMHO. With the 64-bit version creation works as expected.