terraform-routeros / terraform-provider-routeros

Terraform Provider for Mikrotik RouterOS
Mozilla Public License 2.0
191 stars 55 forks source link

routeros_ip_service not working #407

Closed gudge25 closed 6 months ago

gudge25 commented 6 months ago

Terraform will perform the following actions:

routeros_ip_service.www will be created

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

routeros_ip_service.www: Creating... ╷ │ Error: from RouterOS device: unknown parameter │ │ with routeros_ip_service.www, │ on variables.tf line 22, in resource "routeros_ip_service" "www": │ 22: resource "routeros_ip_service" "www" { │

RouterOS 6.49.10 Expected : www service is turned off

image

In Fact - Error

gudge25 commented 6 months ago

maybe it if because "numbers " which. is required is not present in Json `Changes to Outputs:

vaerh commented 6 months ago

Unfortunately there is no way to ensure compatibility and operation of the provider even between major versions of 7.x ROS. For this reason we do not test the provider within ROS 6.x. The easiest way is to upgrade to version 7.10-7.14, there most of the features work as expected. But or make your own build of the provider.

vaerh commented 6 months ago

Run ROS_LOG_COLOR=1 TF_LOG=debug terraform apply and post the green lines

gudge25 commented 6 months ago

` routeros git:(main) ✗ ROS_LOG_COLOR=1 TF_LOG=debug terraform apply 2024-04-04T19:11:23.330+0200 [INFO] Terraform version: 1.5.7 2024-04-04T19:11:23.331+0200 [DEBUG] using github.com/hashicorp/go-tfe v1.26.0 2024-04-04T19:11:23.331+0200 [DEBUG] using github.com/hashicorp/hcl/v2 v2.16.2 2024-04-04T19:11:23.331+0200 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.0 2024-04-04T19:11:23.331+0200 [DEBUG] using github.com/zclconf/go-cty v1.12.2 2024-04-04T19:11:23.331+0200 [INFO] Go runtime version: go1.21.1 2024-04-04T19:11:23.331+0200 [INFO] CLI args: []string{"terraform", "apply"} 2024-04-04T19:11:23.331+0200 [DEBUG] Attempting to open CLI config file: /Users/anton/.terraformrc 2024-04-04T19:11:23.331+0200 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. 2024-04-04T19:11:23.332+0200 [INFO] Loading CLI configuration from /Users/anton/.terraform.d/credentials.tfrc.json 2024-04-04T19:11:23.333+0200 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins 2024-04-04T19:11:23.333+0200 [DEBUG] ignoring non-existing provider search directory /Users/anton/.terraform.d/plugins 2024-04-04T19:11:23.333+0200 [DEBUG] ignoring non-existing provider search directory /Users/anton/Library/Application Support/io.terraform/plugins 2024-04-04T19:11:23.333+0200 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins 2024-04-04T19:11:23.335+0200 [INFO] CLI command args: []string{"apply"} 2024-04-04T19:11:23.346+0200 [DEBUG] Service discovery for app.terraform.io at https://app.terraform.io/.well-known/terraform.json 2024-04-04T19:11:24.637+0200 [DEBUG] Service discovery for app.terraform.io aliased as localterraform.com 2024-04-04T19:11:24.668+0200 [DEBUG] checking for provisioner in "." 2024-04-04T19:11:24.671+0200 [DEBUG] checking for provisioner in "/opt/homebrew/bin" 2024-04-04T19:11:24.870+0200 [INFO] cloud: starting Apply operation Running apply in Terraform Cloud. Output will stream here. Pressing Ctrl-C will cancel the remote apply if it's still pending. If the apply started it will stop streaming the logs, but will not stop the apply running remotely.

Preparing the remote apply...

The remote workspace is configured to work with configuration at routeros relative to the target repository.

Terraform will upload the contents of the following directory, excluding files or directories as defined by a .terraformignore file at /Users/anton/GIT/gs-terraform-cloud/.terraformignore (if it is present), in order to capture the filesystem context the remote workspace expects: /Users/anton/GIT/gs-terraform-cloud

To view this run in a browser, visit: https://app.terraform.io/app/antonsatskyi/terraform-cloud-routeros/runs/run-5ecdEkQCiEFwaKaq

Waiting for the plan to start...

Terraform v1.5.7 on linux_amd64 Initializing plugins and modules... routeros_ip_firewall_addr_list.example_list_router1: Refreshing state... [id=567] routeros_ip_firewall_addr_list.example_list_router0: Refreshing state... [id=A] 2024-04-04T19:11:36.058+0200 [DEBUG] performing request: method=GET url=https://app.terraform.io/api/v2/plans/plan-qLAadVLyBuvpfJ57/json-output-redacted

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:

routeros_ip_service.this will be created

Plan: 1 to add, 0 to change, 0 to destroy. 2024-04-04T19:11:37.844+0200 [DEBUG] command: asking for input: "\nDo you want to perform these actions in workspace \"terraform-cloud-routeros\"?"

Do you want to perform these actions in workspace "terraform-cloud-routeros"? Terraform will perform the actions described above. Only 'yes' will be accepted to approve.

Enter a value: yes

routeros_ip_service.this: Creating... ╷ │ Error: from RouterOS device: unknown parameter │ │ with routeros_ip_service.this, │ on variables.tf line 23, in resource "routeros_ip_service" "this": │ 23: resource "routeros_ip_service" "this" { │ ╵ Operation failed: failed running terraform apply (exit 1)`

vaerh commented 6 months ago

It looks like the cloud ate the debug output. The full debug output should look something like this:

2024-04-04T17:40:16.066+0000 [DEBUG] provider.terraform-provider-routeros_v1.43.0: GET request URL:  https://172.17.0.2/rest/interface/ethernet?default-name=ether4: tf_rpc=Configure @caller=/home/user/terraform-provider-routeros/routeros/log.go:27 @module=routeros tf_provider_addr=terraform-routeros/routeros tf_req_id=b72dc8f6-8f89-2e08-961e-98cba953c5ab timestamp="2024-04-04T17:40:16.066+0000"
2024-04-04T17:40:16.546+0000 [DEBUG] provider.terraform-provider-routeros_v1.43.0: response body: [{".id":"*5","advertise":"10M-baseT-half,10M-baseT-full,100M-baseT-half,100M-baseT-full,1G-baseT-full","arp":"enabled","arp-timeout":"auto","auto-negotiation":"true","cable-settings":"default","default-name":"ether4","disable-running-check":"true","disabled":"false","loop-protect":"default","loop-protect-disable-time":"5m","loop-protect-send-interval":"5s","loop-protect-status":"off","mac-address":"54:05:AB:1E:60:94","mtu":"1500","name":"ether4","orig-mac-address":"54:05:AB:1E:60:94","running":"true","rx-broadcast":"0","rx-bytes":"0","rx-flow-control":"off","rx-multicast":"0","rx-packet":"0","tx-broadcast":"378","tx-bytes":"246103","tx-flow-control":"off","tx-multicast":"1139","tx-packet":"1517"}]: @caller=/home/user/terraform-provider-routeros/routeros/log.go:27 @module=routeros tf_provider_addr=terraform-routeros/routeros tf_req_id=b72dc8f6-8f89-2e08-961e-98cba953c5ab tf_rpc=Configure timestamp="2024-04-04T17:40:16.546+0000"
gudge25 commented 6 months ago

probably this?

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

2024-04-04T19:53:26.079+0200 [INFO]  backend/local: apply calling Apply
2024-04-04T19:53:26.079+0200 [DEBUG] Building and walking apply graph for NormalMode plan
2024-04-04T19:53:26.079+0200 [DEBUG] Resource state not found for node "routeros_ip_service.disabled[\"telnet\"]", instance routeros_ip_service.disabled["telnet"]
2024-04-04T19:53:26.079+0200 [DEBUG] Resource state not found for node "routeros_ip_service.disabled[\"ftp\"]", instance routeros_ip_service.disabled["ftp"]
2024-04-04T19:53:26.079+0200 [DEBUG] Resource state not found for node "routeros_ip_service.disabled[\"www\"]", instance routeros_ip_service.disabled["www"]
2024-04-04T19:53:26.080+0200 [DEBUG] ProviderTransformer: "routeros_ip_service.disabled[\"ftp\"]" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/terraform-routeros/routeros"]
2024-04-04T19:53:26.080+0200 [DEBUG] ProviderTransformer: "routeros_ip_service.disabled[\"www\"]" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/terraform-routeros/routeros"]
2024-04-04T19:53:26.080+0200 [DEBUG] ProviderTransformer: "routeros_ip_service.disabled (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/terraform-routeros/routeros"]
2024-04-04T19:53:26.080+0200 [DEBUG] ProviderTransformer: "routeros_ip_service.disabled[\"telnet\"]" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/terraform-routeros/routeros"]
2024-04-04T19:53:26.083+0200 [DEBUG] ReferenceTransformer: "local.enable_service (expand)" references: []
2024-04-04T19:53:26.083+0200 [DEBUG] ReferenceTransformer: "local.disable_service (expand)" references: []
2024-04-04T19:53:26.083+0200 [INFO]  ReferenceTransformer: reference not found: "each.key"
2024-04-04T19:53:26.083+0200 [INFO]  ReferenceTransformer: reference not found: "each.value"
2024-04-04T19:53:26.083+0200 [DEBUG] ReferenceTransformer: "routeros_ip_service.disabled[\"telnet\"]" references: [local.disable_service (expand)]
2024-04-04T19:53:26.084+0200 [INFO]  ReferenceTransformer: reference not found: "each.key"
2024-04-04T19:53:26.084+0200 [INFO]  ReferenceTransformer: reference not found: "each.value"
2024-04-04T19:53:26.084+0200 [DEBUG] ReferenceTransformer: "routeros_ip_service.disabled[\"ftp\"]" references: [local.disable_service (expand)]
2024-04-04T19:53:26.084+0200 [INFO]  ReferenceTransformer: reference not found: "each.key"
2024-04-04T19:53:26.084+0200 [INFO]  ReferenceTransformer: reference not found: "each.value"
2024-04-04T19:53:26.084+0200 [DEBUG] ReferenceTransformer: "routeros_ip_service.disabled[\"www\"]" references: [local.disable_service (expand)]
2024-04-04T19:53:26.084+0200 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/terraform-routeros/routeros\"]" references: []
2024-04-04T19:53:26.084+0200 [DEBUG] ReferenceTransformer: "routeros_ip_service.disabled (expand)" references: [local.disable_service (expand)]
2024-04-04T19:53:26.085+0200 [DEBUG] pruneUnusedNodes: local.enable_service (expand) is no longer needed, removing
2024-04-04T19:53:26.085+0200 [DEBUG] Starting graph walk: walkApply
2024-04-04T19:53:26.086+0200 [DEBUG] created provider logger: level=debug
2024-04-04T19:53:26.086+0200 [INFO]  provider: configuring client automatic mTLS
2024-04-04T19:53:26.092+0200 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0 args=[.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0]
2024-04-04T19:53:26.095+0200 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0 pid=43432
2024-04-04T19:53:26.095+0200 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0
2024-04-04T19:53:26.105+0200 [INFO]  provider.terraform-provider-routeros_v1.44.0: configuring server automatic mTLS: timestamp=2024-04-04T19:53:26.105+0200
2024-04-04T19:53:26.118+0200 [DEBUG] provider.terraform-provider-routeros_v1.44.0: plugin address: address=/var/folders/ps/lcq6km7x6ts2kwg1ntf09frm0000gn/T/plugin4252523313 network=unix timestamp=2024-04-04T19:53:26.118+0200
2024-04-04T19:53:26.118+0200 [DEBUG] provider: using plugin: version=5
2024-04-04T19:53:26.274+0200 [WARN]  Provider "registry.terraform.io/terraform-routeros/routeros" produced an invalid plan for routeros_ip_service.disabled["telnet"], but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .certificate: planned value cty.StringVal("none") for a non-computed attribute
      - .vrf: planned value cty.StringVal("main") for a non-computed attribute
      - .tls_version: planned value cty.StringVal("any") for a non-computed attribute
2024-04-04T19:53:26.274+0200 [WARN]  Provider "registry.terraform.io/terraform-routeros/routeros" produced an invalid plan for routeros_ip_service.disabled["ftp"], but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .tls_version: planned value cty.StringVal("any") for a non-computed attribute
      - .vrf: planned value cty.StringVal("main") for a non-computed attribute
      - .certificate: planned value cty.StringVal("none") for a non-computed attribute
2024-04-04T19:53:26.274+0200 [WARN]  Provider "registry.terraform.io/terraform-routeros/routeros" produced an invalid plan for routeros_ip_service.disabled["www"], but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .tls_version: planned value cty.StringVal("any") for a non-computed attribute
      - .certificate: planned value cty.StringVal("none") for a non-computed attribute
      - .vrf: planned value cty.StringVal("main") for a non-computed attribute
routeros_ip_service.disabled["www"]: Creating...
routeros_ip_service.disabled["telnet"]: Creating...
2024-04-04T19:53:26.275+0200 [INFO]  Starting apply for routeros_ip_service.disabled["telnet"]
routeros_ip_service.disabled["ftp"]: Creating...
2024-04-04T19:53:26.276+0200 [INFO]  Starting apply for routeros_ip_service.disabled["ftp"]
2024-04-04T19:53:26.276+0200 [DEBUG] routeros_ip_service.disabled["telnet"]: applying the planned Create change
2024-04-04T19:53:26.276+0200 [DEBUG] routeros_ip_service.disabled["ftp"]: applying the planned Create change
2024-04-04T19:53:26.276+0200 [INFO]  Starting apply for routeros_ip_service.disabled["www"]
2024-04-04T19:53:26.277+0200 [DEBUG] routeros_ip_service.disabled["www"]: applying the planned Create change
2024-04-04T19:53:26.277+0200 [DEBUG] provider.terraform-provider-routeros_v1.44.0: request body:  /ip/service/set =numbers=ftp =port=21 =vrf=main =tls-version=any =certificate=none =disabled=yes: @module=routeros tf_provider_addr=terraform-routeros/routeros tf_req_id=245b52fe-35df-a15f-2659-4a22fc514331 tf_rpc=Configure @caller=github.com/terraform-routeros/terraform-provider-routeros/routeros/log.go:27 timestamp=2024-04-04T19:53:26.277+0200
2024-04-04T19:53:26.277+0200 [DEBUG] provider.terraform-provider-routeros_v1.44.0: request body:  /ip/service/set =disabled=yes =numbers=www =port=80 =vrf=main =certificate=none =tls-version=any: tf_req_id=245b52fe-35df-a15f-2659-4a22fc514331 tf_rpc=Configure @caller=github.com/terraform-routeros/terraform-provider-routeros/routeros/log.go:27 @module=routeros tf_provider_addr=terraform-routeros/routeros timestamp=2024-04-04T19:53:26.277+0200
2024-04-04T19:53:26.278+0200 [DEBUG] provider.terraform-provider-routeros_v1.44.0: request body:  /ip/service/set =certificate=none =disabled=yes =numbers=telnet =port=23 =vrf=main =tls-version=any: tf_provider_addr=terraform-routeros/routeros tf_req_id=245b52fe-35df-a15f-2659-4a22fc514331 tf_rpc=Configure @caller=github.com/terraform-routeros/terraform-provider-routeros/routeros/log.go:27 @module=routeros timestamp=2024-04-04T19:53:26.278+0200
2024-04-04T19:53:26.455+0200 [ERROR] provider.terraform-provider-routeros_v1.44.0: Response contains error diagnostic: diagnostic_detail= tf_provider_addr=terraform-routeros/routeros tf_req_id=368ffb74-333a-2ce4-378e-4258b440b523 @module=sdk.proto tf_resource_type=routeros_ip_service @caller=github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/internal/diag/diagnostics.go:58 tf_rpc=ApplyResourceChange diagnostic_summary="from RouterOS device: unknown parameter" tf_proto_version=5.4 diagnostic_severity=ERROR timestamp=2024-04-04T19:53:26.455+0200
2024-04-04T19:53:26.455+0200 [ERROR] provider.terraform-provider-routeros_v1.44.0: Response contains error diagnostic: tf_provider_addr=terraform-routeros/routeros tf_rpc=ApplyResourceChange diagnostic_detail= diagnostic_severity=ERROR diagnostic_summary="from RouterOS device: unknown parameter" tf_resource_type=routeros_ip_service @caller=github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/internal/diag/diagnostics.go:58 @module=sdk.proto tf_proto_version=5.4 tf_req_id=f711b4f7-239d-abd6-2664-1342f485e7f2 timestamp=2024-04-04T19:53:26.455+0200
2024-04-04T19:53:26.456+0200 [ERROR] provider.terraform-provider-routeros_v1.44.0: Response contains error diagnostic: diagnostic_severity=ERROR tf_proto_version=5.4 diagnostic_summary="from RouterOS device: unknown parameter" @caller=github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/internal/diag/diagnostics.go:58 @module=sdk.proto diagnostic_detail= tf_provider_addr=terraform-routeros/routeros tf_req_id=69e588eb-e0e4-014b-2824-f12fd2ba649b tf_rpc=ApplyResourceChange tf_resource_type=routeros_ip_service timestamp=2024-04-04T19:53:26.455+0200
2024-04-04T19:53:26.459+0200 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-04-04T19:53:26.459+0200 [ERROR] vertex "routeros_ip_service.disabled[\"telnet\"]" error: from RouterOS device: unknown parameter
2024-04-04T19:53:26.463+0200 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-04-04T19:53:26.463+0200 [ERROR] vertex "routeros_ip_service.disabled[\"ftp\"]" error: from RouterOS device: unknown parameter
2024-04-04T19:53:26.467+0200 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-04-04T19:53:26.467+0200 [ERROR] vertex "routeros_ip_service.disabled[\"www\"]" error: from RouterOS device: unknown parameter
╷
│ Error: from RouterOS device: unknown parameter
│
│   with routeros_ip_service.disabled["www"],
│   on main.tf line 24, in resource "routeros_ip_service" "disabled":
│   24: resource "routeros_ip_service" "disabled" {
│
╵
╷
│ Error: from RouterOS device: unknown parameter
│
│   with routeros_ip_service.disabled["telnet"],
│   on main.tf line 24, in resource "routeros_ip_service" "disabled":
│   24: resource "routeros_ip_service" "disabled" {
│
╵
╷
│ Error: from RouterOS device: unknown parameter
│
│   with routeros_ip_service.disabled["ftp"],
│   on main.tf line 24, in resource "routeros_ip_service" "disabled":
│   24: resource "routeros_ip_service" "disabled" {
│
╵
2024-04-04T19:53:26.478+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-04-04T19:53:26.479+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0 pid=43432
2024-04-04T19:53:26.479+0200 [DEBUG] provider: plugin exited
gudge25 commented 6 months ago

here is a GREEN part image

gudge25 commented 6 months ago

maytbe this vrf=main can cause an issue. because I have no this parameter

image
vaerh commented 6 months ago

Can you try this?

resource "routeros_ip_service" "www" {
    numbers = "*2"
    port = 80
    disabled = true
}
gudge25 commented 6 months ago
locals {
  disable_service = {"ftp" = 21, "telnet" = 23, "www" = 80}
  enable_service  = {"ssh" = 22, "winbox" = 8291}
}

# resource "routeros_ip_service" "disabled" {
#   for_each = local.disable_service
#   numbers  = each.key
#   port     = each.value
#   disabled = true
# }

resource "routeros_ip_service" "www" {
    numbers = "*2"
    port = 80
    disabled = true
}%
╭─anton@Antons-MacBook-Pro-2  ~/GIT/gs-terraform-cloud/tempRouteros ‹node-›  ‹› (main*)
╰─$ ROS_LOG_COLOR=1 TF_LOG=debug terraform apply
2024-04-04T20:19:16.118+0200 [INFO]  Terraform version: 1.5.7
2024-04-04T20:19:16.119+0200 [DEBUG] using github.com/hashicorp/go-tfe v1.26.0
2024-04-04T20:19:16.119+0200 [DEBUG] using github.com/hashicorp/hcl/v2 v2.16.2
2024-04-04T20:19:16.119+0200 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.0
2024-04-04T20:19:16.119+0200 [DEBUG] using github.com/zclconf/go-cty v1.12.2
2024-04-04T20:19:16.119+0200 [INFO]  Go runtime version: go1.21.1
2024-04-04T20:19:16.119+0200 [INFO]  CLI args: []string{"terraform", "apply"}
2024-04-04T20:19:16.119+0200 [DEBUG] Attempting to open CLI config file: /Users/anton/.terraformrc
2024-04-04T20:19:16.119+0200 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2024-04-04T20:19:16.119+0200 [INFO]  Loading CLI configuration from /Users/anton/.terraform.d/credentials.tfrc.json
2024-04-04T20:19:16.120+0200 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2024-04-04T20:19:16.120+0200 [DEBUG] ignoring non-existing provider search directory /Users/anton/.terraform.d/plugins
2024-04-04T20:19:16.120+0200 [DEBUG] ignoring non-existing provider search directory /Users/anton/Library/Application Support/io.terraform/plugins
2024-04-04T20:19:16.120+0200 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2024-04-04T20:19:16.121+0200 [INFO]  CLI command args: []string{"apply"}
2024-04-04T20:19:16.123+0200 [DEBUG] New state was assigned lineage "4cd3e2e7-e7bd-9736-830f-f9eb1cef7563"
2024-04-04T20:19:16.140+0200 [DEBUG] checking for provisioner in "."
2024-04-04T20:19:16.142+0200 [DEBUG] checking for provisioner in "/opt/homebrew/bin"
2024-04-04T20:19:16.143+0200 [INFO]  backend/local: starting Apply operation
2024-04-04T20:19:16.146+0200 [DEBUG] created provider logger: level=debug
2024-04-04T20:19:16.146+0200 [INFO]  provider: configuring client automatic mTLS
2024-04-04T20:19:16.153+0200 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0 args=[.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0]
2024-04-04T20:19:16.154+0200 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0 pid=61973
2024-04-04T20:19:16.154+0200 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0
2024-04-04T20:19:16.163+0200 [INFO]  provider.terraform-provider-routeros_v1.44.0: configuring server automatic mTLS: timestamp=2024-04-04T20:19:16.163+0200
2024-04-04T20:19:16.171+0200 [DEBUG] provider: using plugin: version=5
2024-04-04T20:19:16.171+0200 [DEBUG] provider.terraform-provider-routeros_v1.44.0: plugin address: address=/var/folders/ps/lcq6km7x6ts2kwg1ntf09frm0000gn/T/plugin2293840467 network=unix timestamp=2024-04-04T20:19:16.171+0200
2024-04-04T20:19:16.188+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-04-04T20:19:16.188+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0 pid=61973
2024-04-04T20:19:16.188+0200 [DEBUG] provider: plugin exited
2024-04-04T20:19:16.188+0200 [DEBUG] Building and walking validate graph
2024-04-04T20:19:16.189+0200 [DEBUG] ProviderTransformer: "routeros_ip_service.www" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/terraform-routeros/routeros"]
2024-04-04T20:19:16.189+0200 [DEBUG] ReferenceTransformer: "routeros_ip_service.www" references: []
2024-04-04T20:19:16.189+0200 [DEBUG] ReferenceTransformer: "local.disable_service (expand)" references: []
2024-04-04T20:19:16.189+0200 [DEBUG] ReferenceTransformer: "local.enable_service (expand)" references: []
2024-04-04T20:19:16.189+0200 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/terraform-routeros/routeros\"]" references: []
2024-04-04T20:19:16.189+0200 [DEBUG] Starting graph walk: walkValidate
2024-04-04T20:19:16.191+0200 [DEBUG] created provider logger: level=debug
2024-04-04T20:19:16.191+0200 [INFO]  provider: configuring client automatic mTLS
2024-04-04T20:19:16.193+0200 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0 args=[.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0]
2024-04-04T20:19:16.194+0200 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0 pid=61974
2024-04-04T20:19:16.194+0200 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0
2024-04-04T20:19:16.199+0200 [INFO]  provider.terraform-provider-routeros_v1.44.0: configuring server automatic mTLS: timestamp=2024-04-04T20:19:16.199+0200
2024-04-04T20:19:16.206+0200 [DEBUG] provider.terraform-provider-routeros_v1.44.0: plugin address: address=/var/folders/ps/lcq6km7x6ts2kwg1ntf09frm0000gn/T/plugin2736855831 network=unix timestamp=2024-04-04T20:19:16.206+0200
2024-04-04T20:19:16.206+0200 [DEBUG] provider: using plugin: version=5
2024-04-04T20:19:16.221+0200 [ERROR] provider.terraform-provider-routeros_v1.44.0: Response contains error diagnostic: diagnostic_attribute=AttributeName("numbers") tf_provider_addr=terraform-routeros/routeros @module=sdk.proto tf_proto_version=5.4 tf_resource_type=routeros_ip_service @caller=github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_severity=ERROR diagnostic_summary="Bad value" tf_req_id=9bccd87e-ec74-d56a-3606-a4ae0f2cfe3c tf_rpc=ValidateResourceTypeConfig diagnostic_detail="Unexpected value: *2" timestamp=2024-04-04T20:19:16.221+0200
2024-04-04T20:19:16.221+0200 [ERROR] vertex "routeros_ip_service.www" error: Bad value
╷
│ Error: Bad value
│
│   with routeros_ip_service.www,
│   on main.tf line 32, in resource "routeros_ip_service" "www":
│   32:     numbers = "*2"
│
│ Unexpected value: *2
╵
2024-04-04T20:19:16.221+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-04-04T20:19:16.222+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.0/darwin_arm64/terraform-provider-routeros_v1.44.0 pid=61974
2024-04-04T20:19:16.222+0200 [DEBUG] provider: plugin exited
vaerh commented 6 months ago

:tada: This issue has been resolved in version 1.44.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

vaerh commented 6 months ago

Please check again my config after the release.

gudge25 commented 6 months ago

this config right?


resource "routeros_ip_service" "www" {
    numbers = "*2"
    port = 80
    disabled = true
}
vaerh commented 6 months ago

Yes

gudge25 commented 6 months ago
  # routeros_ip_service.www will be created
  + resource "routeros_ip_service" "www" {
      + certificate = "none"
      + disabled    = true
      + id          = (known after apply)
      + invalid     = (known after apply)
      + name        = (known after apply)
      + numbers     = "*2"
      + port        = 80
      + tls_version = "any"
      + vrf         = "main"
    }

Plan: 1 to add, 0 to change, 3 to destroy.
2024-04-04T20:58:39.491+0200 [DEBUG] command: asking for input: "\nDo you want to perform these actions?"

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

2024-04-04T20:58:57.550+0200 [INFO]  backend/local: apply calling Apply
2024-04-04T20:58:57.550+0200 [DEBUG] Building and walking apply graph for NormalMode plan
2024-04-04T20:58:57.555+0200 [DEBUG] Resource state not found for node "routeros_ip_service.www", instance routeros_ip_service.www
2024-04-04T20:58:57.556+0200 [DEBUG] ProviderTransformer: "routeros_ip_service.disabled[\"telnet\"] (destroy)" (*terraform.NodeDestroyResourceInstance) needs provider["registry.terraform.io/terraform-routeros/routeros"]
2024-04-04T20:58:57.556+0200 [DEBUG] ProviderTransformer: "routeros_ip_service.disabled[\"ftp\"] (destroy)" (*terraform.NodeDestroyResourceInstance) needs provider["registry.terraform.io/terraform-routeros/routeros"]
2024-04-04T20:58:57.556+0200 [DEBUG] ProviderTransformer: "routeros_ip_service.disabled[\"www\"] (destroy)" (*terraform.NodeDestroyResourceInstance) needs provider["registry.terraform.io/terraform-routeros/routeros"]
2024-04-04T20:58:57.556+0200 [DEBUG] ProviderTransformer: "routeros_ip_service.www (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/terraform-routeros/routeros"]
2024-04-04T20:58:57.556+0200 [DEBUG] ProviderTransformer: "routeros_ip_service.www" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/terraform-routeros/routeros"]
2024-04-04T20:58:57.557+0200 [DEBUG] ReferenceTransformer: "local.disable_service (expand)" references: []
2024-04-04T20:58:57.557+0200 [DEBUG] ReferenceTransformer: "routeros_ip_service.www" references: []
2024-04-04T20:58:57.557+0200 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/terraform-routeros/routeros\"]" references: []
2024-04-04T20:58:57.557+0200 [DEBUG] ReferenceTransformer: "routeros_ip_service.www (expand)" references: []
2024-04-04T20:58:57.557+0200 [DEBUG] ReferenceTransformer: "local.enable_service (expand)" references: []
2024-04-04T20:58:57.557+0200 [DEBUG] pruneUnusedNodes: local.enable_service (expand) is no longer needed, removing
2024-04-04T20:58:57.557+0200 [DEBUG] pruneUnusedNodes: local.disable_service (expand) is no longer needed, removing
2024-04-04T20:58:57.558+0200 [DEBUG] Starting graph walk: walkApply
2024-04-04T20:58:57.559+0200 [DEBUG] created provider logger: level=debug
2024-04-04T20:58:57.559+0200 [INFO]  provider: configuring client automatic mTLS
2024-04-04T20:58:57.566+0200 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.1/darwin_arm64/terraform-provider-routeros_v1.44.1 args=[.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.1/darwin_arm64/terraform-provider-routeros_v1.44.1]
2024-04-04T20:58:57.569+0200 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.1/darwin_arm64/terraform-provider-routeros_v1.44.1 pid=90485
2024-04-04T20:58:57.569+0200 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.1/darwin_arm64/terraform-provider-routeros_v1.44.1
2024-04-04T20:58:57.611+0200 [INFO]  provider.terraform-provider-routeros_v1.44.1: configuring server automatic mTLS: timestamp=2024-04-04T20:58:57.611+0200
2024-04-04T20:58:57.624+0200 [DEBUG] provider.terraform-provider-routeros_v1.44.1: plugin address: address=/var/folders/ps/lcq6km7x6ts2kwg1ntf09frm0000gn/T/plugin2607264580 network=unix timestamp=2024-04-04T20:58:57.624+0200
2024-04-04T20:58:57.624+0200 [DEBUG] provider: using plugin: version=5
routeros_ip_service.disabled["ftp"]: Destroying... [id=ftp]
routeros_ip_service.disabled["www"]: Destroying... [id=www]
2024-04-04T20:58:57.912+0200 [INFO]  Starting apply for routeros_ip_service.disabled["ftp"]
2024-04-04T20:58:57.912+0200 [DEBUG] routeros_ip_service.disabled["ftp"]: applying the planned Delete change
routeros_ip_service.disabled["telnet"]: Destroying... [id=telnet]
2024-04-04T20:58:57.912+0200 [INFO]  Starting apply for routeros_ip_service.disabled["telnet"]
2024-04-04T20:58:57.912+0200 [DEBUG] routeros_ip_service.disabled["telnet"]: applying the planned Delete change
2024-04-04T20:58:57.912+0200 [INFO]  Starting apply for routeros_ip_service.disabled["www"]
2024-04-04T20:58:57.912+0200 [DEBUG] routeros_ip_service.disabled["www"]: applying the planned Delete change
2024-04-04T20:58:57.914+0200 [WARN]  provider.terraform-provider-routeros_v1.44.1: Response contains warning diagnostic: diagnostic_severity=WARNING tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/internal/diag/diagnostics.go:60 diagnostic_detail="This resource contains system settings and cannot be deleted or reset. This action will remove the object from the Terraform state. See also: 'terraform state rm' https://developer.hashicorp.com/terraform/cli/commands/state/rm" tf_proto_version=5.4 diagnostic_summary="Delete operation on a system object." @module=sdk.proto tf_provider_addr=terraform-routeros/routeros tf_req_id=f7f4e94a-25c7-8ac6-0233-219e34708679 tf_resource_type=routeros_ip_service timestamp=2024-04-04T20:58:57.913+0200
2024-04-04T20:58:57.914+0200 [WARN]  provider.terraform-provider-routeros_v1.44.1: Response contains warning diagnostic: tf_resource_type=routeros_ip_service diagnostic_detail="This resource contains system settings and cannot be deleted or reset. This action will remove the object from the Terraform state. See also: 'terraform state rm' https://developer.hashicorp.com/terraform/cli/commands/state/rm" tf_rpc=ApplyResourceChange @module=sdk.proto diagnostic_summary="Delete operation on a system object." tf_req_id=7570d85d-6297-5719-95df-5a4f22aa8129 @caller=github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/internal/diag/diagnostics.go:60 diagnostic_severity=WARNING tf_proto_version=5.4 tf_provider_addr=terraform-routeros/routeros timestamp=2024-04-04T20:58:57.913+0200
2024-04-04T20:58:57.914+0200 [WARN]  provider.terraform-provider-routeros_v1.44.1: Response contains warning diagnostic: diagnostic_summary="Delete operation on a system object." tf_proto_version=5.4 tf_provider_addr=terraform-routeros/routeros tf_req_id=9db27158-09cd-76c6-4624-3aa845248f12 tf_rpc=ApplyResourceChange @module=sdk.proto tf_resource_type=routeros_ip_service diagnostic_severity=WARNING @caller=github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/internal/diag/diagnostics.go:60 diagnostic_detail="This resource contains system settings and cannot be deleted or reset. This action will remove the object from the Terraform state. See also: 'terraform state rm' https://developer.hashicorp.com/terraform/cli/commands/state/rm" timestamp=2024-04-04T20:58:57.914+0200
2024-04-04T20:58:57.914+0200 [WARN]  Provider "registry.terraform.io/terraform-routeros/routeros" produced an invalid plan for routeros_ip_service.www, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .tls_version: planned value cty.StringVal("any") for a non-computed attribute
      - .vrf: planned value cty.StringVal("main") for a non-computed attribute
      - .certificate: planned value cty.StringVal("none") for a non-computed attribute
routeros_ip_service.disabled["telnet"]: Destruction complete after 0s
routeros_ip_service.disabled["ftp"]: Destruction complete after 0s
routeros_ip_service.disabled["www"]: Destruction complete after 0s
routeros_ip_service.www: Creating...
2024-04-04T20:58:57.914+0200 [INFO]  Starting apply for routeros_ip_service.www
2024-04-04T20:58:57.915+0200 [DEBUG] routeros_ip_service.www: applying the planned Create change
2024-04-04T20:58:57.916+0200 [DEBUG] provider.terraform-provider-routeros_v1.44.1: request body:  /ip/service/set =disabled=yes =port=80 =tls-version=any =vrf=main =numbers=*2 =certificate=none: @module=routeros tf_provider_addr=terraform-routeros/routeros tf_req_id=b27c1d39-b297-f81a-d2ff-e0b44dd5752c tf_rpc=Configure @caller=github.com/terraform-routeros/terraform-provider-routeros/routeros/log.go:27 timestamp=2024-04-04T20:58:57.915+0200
2024-04-04T20:58:57.921+0200 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-04-04T20:58:57.924+0200 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-04-04T20:58:57.928+0200 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-04-04T20:58:57.975+0200 [ERROR] provider.terraform-provider-routeros_v1.44.1: Response contains error diagnostic: diagnostic_detail= diagnostic_summary="from RouterOS device: unknown parameter" tf_proto_version=5.4 diagnostic_severity=ERROR tf_resource_type=routeros_ip_service @caller=github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/internal/diag/diagnostics.go:58 tf_provider_addr=terraform-routeros/routeros tf_rpc=ApplyResourceChange @module=sdk.proto tf_req_id=e4ab9715-3c07-0369-297e-7a5b329f89e4 timestamp=2024-04-04T20:58:57.974+0200
2024-04-04T20:58:57.979+0200 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-04-04T20:58:57.979+0200 [ERROR] vertex "routeros_ip_service.www" error: from RouterOS device: unknown parameter
╷
│ Warning: Delete operation on a system object.
│
│ This resource contains system settings and cannot be deleted or reset. This action will remove the object from the Terraform state. See also: 'terraform state rm' https://developer.hashicorp.com/terraform/cli/commands/state/rm
╵
╷
│ Warning: Delete operation on a system object.
│
│ This resource contains system settings and cannot be deleted or reset. This action will remove the object from the Terraform state. See also: 'terraform state rm' https://developer.hashicorp.com/terraform/cli/commands/state/rm
╵
╷
│ Warning: Delete operation on a system object.
│
│ This resource contains system settings and cannot be deleted or reset. This action will remove the object from the Terraform state. See also: 'terraform state rm' https://developer.hashicorp.com/terraform/cli/commands/state/rm
╵
╷
│ Error: from RouterOS device: unknown parameter
│
│   with routeros_ip_service.www,
│   on main.tf line 30, in resource "routeros_ip_service" "www":
│   30: resource "routeros_ip_service" "www" {
│
╵
2024-04-04T20:58:57.988+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-04-04T20:58:57.990+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/terraform-routeros/routeros/1.44.1/darwin_arm64/terraform-provider-routeros_v1.44.1 pid=90485
2024-04-04T20:58:57.990+0200 [DEBUG] provider: plugin exited
gudge25 commented 6 months ago

image

vrf is still there

vaerh commented 6 months ago

Yes, you're right. I didn't look at the log carefully enough. After changes in parameters vrf, tls_version & certificate should not appear implicitly. The release is on the way.

vaerh commented 6 months ago

:tada: This issue has been resolved in version 1.44.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

gudge25 commented 6 months ago

Brilliant @vaerh

Terraform will perform the following actions:

  # routeros_ip_service.disabled["ftp"] will be created
  + resource "routeros_ip_service" "disabled" {
      + disabled = true
      + id       = (known after apply)
      + invalid  = (known after apply)
      + name     = (known after apply)
      + numbers  = "ftp"
      + port     = 21
    }

  # routeros_ip_service.disabled["telnet"] will be created
  + resource "routeros_ip_service" "disabled" {
      + disabled = true
      + id       = (known after apply)
      + invalid  = (known after apply)
      + name     = (known after apply)
      + numbers  = "telnet"
      + port     = 23
    }

  # routeros_ip_service.disabled["www"] will be created
  + resource "routeros_ip_service" "disabled" {
      + disabled = true
      + id       = (known after apply)
      + invalid  = (known after apply)
      + name     = (known after apply)
      + numbers  = "www"
      + port     = 80
    }
image