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

Terraform provider cant create role with ssh_port_forwarding #52285

Open
medva1997 opened this issue Feb 19, 2025 · 0 comments
Open

Terraform provider cant create role with ssh_port_forwarding #52285

medva1997 opened this issue Feb 19, 2025 · 0 comments
Assignees
Labels
bug server-access terraform-provider Issues relating to the Teleport Terraform provider in the teleport-plugins repo

Comments

@medva1997
Copy link

According https://goteleport.com/docs/reference/terraform-provider/resources/role/ port_forwarding option was deprecated (and now we need to use ssh_port_forwarding option) but terraform provider cant create role with ssh_port_forwarding

Example

terraform {
  required_providers {
    teleport = {
      source  = "terraform.releases.teleport.dev/gravitational/teleport"
      version = "17.2.7"
    }
  }
}

provider "teleport" {
  addr        = "teleport.company-name.com:443"
}

resource "teleport_role" "test-role" {
  version = "v7"
  metadata = {
    name        = "test-role"
  }
  spec = {
    allow = {
    }
    options = {
      ssh_port_forwarding = {
        local = {
          enabled = false
        }
        remote = {
          enabled = false
        }
      }
    }
  }
}

Expected behavior:
New role must successfully create

Current behavior:

Plan: 1 to add, 0 to change, 0 to destroy.
teleport_role.test-role: Creating...
╷
│ Error: Error creating Role
│
│   with teleport_role.test-role,
│   on teleport.tf line 14, in resource "teleport_role" "test-role":
│   14: resource "teleport_role" "test-role" {
│
│ options define both 'port_forwarding' and 'ssh_port_forwarding', only one can be set

Bug details:
Terraform provider 17.2.7
Proxy version: 17.2.7

$ tsh version
Teleport v17.2.6 git:v17.2.6-0-g8089572 go1.23.5
Proxy version: 17.2.7
Proxy: teleport.company-name.com:443
  • Recreation steps
$ terraform init
Initializing the backend...
Initializing provider plugins...
- Reusing previous version of terraform.releases.teleport.dev/gravitational/teleport from the dependency lock file
- Using previously-installed terraform.releases.teleport.dev/gravitational/teleport v17.2.7

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

$ terraform apply -auto-approve

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

Terraform will perform the following actions:

  # teleport_role.test-role will be created
  + resource "teleport_role" "test-role" {
      + id       = (known after apply)
      + kind     = (known after apply)
      + metadata = {
          + name      = "test-role"
          + namespace = (known after apply)
        }
      + spec     = {
          + allow   = {
              + kubernetes_resources = (known after apply)
            }
          + options = {
              + cert_format         = (known after apply)
              + enhanced_recording  = (known after apply)
              + max_session_ttl     = (known after apply)
              + ssh_port_forwarding = {
                  + local  = {
                      + enabled = false
                    }
                  + remote = {
                      + enabled = false
                    }
                }
            }
        }
      + version  = "v7"
    }

Plan: 1 to add, 0 to change, 0 to destroy.
teleport_role.test-role: Creating...
╷
│ Error: Error creating Role
│
│   with teleport_role.test-role,
│   on teleport.tf line 14, in resource "teleport_role" "test-role":
│   14: resource "teleport_role" "test-role" {
│
│ options define both 'port_forwarding' and 'ssh_port_forwarding', only one can be set
╵
@medva1997 medva1997 added the bug label Feb 19, 2025
@zmb3 zmb3 added server-access terraform-provider Issues relating to the Teleport Terraform provider in the teleport-plugins repo labels Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug server-access terraform-provider Issues relating to the Teleport Terraform provider in the teleport-plugins repo
Projects
None yet
Development

No branches or pull requests

3 participants