Skip to content
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

Error getting custom fields for updating: Error from API (200): No custom fields defined #73

Closed
eugene-marchanka opened this issue May 23, 2023 · 2 comments

Comments

@eugene-marchanka
Copy link

eugene-marchanka commented May 23, 2023

I'm recently upgraded to 1.5.2 and started getting error:

phpipam_first_free_subnet.new_subnet: Modifying... [id=1608]
╷
│ Error: Error getting custom fields for updating: Error from API (200): No custom fields defined
│ 
│   with phpipam_first_free_subnet.new_subnet,
│   on networking.tf line 6, in resource "phpipam_first_free_subnet" "new_subnet":
│    6: resource "phpipam_first_free_subnet" "new_subnet" {
│ 
╵

.tf is pretty standard:

data "phpipam_subnet" "master-subnet" {
  subnet_address = var.master_subnet_ip
  subnet_mask    = var.master_subnet_mask
}

resource "phpipam_first_free_subnet" "new_subnet" {
  parent_subnet_id = data.phpipam_subnet.master-subnet.subnet_id
  subnet_mask      = var.vpc_subnet_cidr_length
  description      = format("EKS subnet for %s", var.cluster_domain)
  custom_fields = {
    custom_Field = "custom-Field"
  }
  vrf_id           = 1
  is_full          = true
}

Any ideas why it is failing?
Thanks!

@pavel-z1
Copy link
Collaborator

pavel-z1 commented May 23, 2023

Hi @eugene-marchanka

According to the README file use next custom field format:
⚠️ NOTE on custom fields: PHPIPAM installations with custom fields must have all fields set to optional when using this plugin. For more info see https://github.com/phpipam/phpipam/issues/1073. Further to this, either ensure that your fields also do not have default values, or ensure the default is set in your TF configuration. Diff loops may happen otherwise! Custom fileds must contain mandatory prefix custom_.

Example:

data "phpipam_section" "section" {
  name = "Customers"
}

resource "phpipam_subnet" "subnet" {
  section_id     = data.phpipam_section.section.section_id
  subnet_address = "10.10.3.0"
  subnet_mask    = 24

  custom_fields = {
    custom_CustomTestSubnets = "terraform-test"
  }
}

@eugene-marchanka
Copy link
Author

eugene-marchanka commented May 23, 2023

Was able to solve it by providing empty custom_fields and specific lifecycle:

resource "phpipam_first_free_subnet" "new_subnet" {
  parent_subnet_id = data.phpipam_subnet.master-subnet.subnet_id
  subnet_mask      = var.vpc_subnet_cidr_length
  description      = format("EKS subnet for %s", var.cluster_domain)
  vrf_id           = 1
  is_full          = true
  custom_fields    = {}
  lifecycle {
    ignore_changes = [
      section_id
    ]
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants