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

dhcp_lease resources generated by Terraformer generate invalid plans for v0.6.1 and later #43

Open
ddelnano opened this issue Jul 28, 2021 · 0 comments

Comments

@ddelnano
Copy link
Owner

I recently updated my homelab to use v0.7.0 of the provider. Terraform config generated with terraformer will create the mikrotik_dhcp_lease resource with a hostname if one is configured. Prior to v0.6.1 of the provider that was fine, because the hostname field was treated as an attribute (and never as an argument). So it was only used on read operations and never on create or update. However, when #36 was merged (specifically this change), the hostname field was added to the create and update calls. According to the mikrotik docs, this field is read only and so it's not possible to create or update this field.

Screenshot_20210727_222648

There are two problems here:

  1. The dhcp_lease resource shouldn't expose an "input" that can't be used as an argument
  2. The hostname attribute should only be used on read operations (essentially undoing part of Correct Mikrotik command building #36). This rule extends to all resources since that prepare{Resource} pattern is used across the code base
$ git grep 'func prepare[A-Z]'
mikrotik/resource_bgp_instance.go:func prepareBgpInstance(d *schema.ResourceData) *client.BgpInstance {
mikrotik/resource_bgp_peer.go:func prepareBgpPeer(d *schema.ResourceData) *client.BgpPeer {
mikrotik/resource_dhcp_lease.go:func prepareDhcpLease(d *schema.ResourceData) *client.DhcpLease {
mikrotik/resource_dns_record.go:func prepareDnsRecord(d *schema.ResourceData) *client.DnsRecord {
mikrotik/resource_pool.go:func preparePool(d *schema.ResourceData) *client.Pool {
mikrotik/resource_scheduler.go:func prepareScheduler(d *schema.ResourceData) *client.Scheduler {
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

1 participant