hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.4k stars 9.5k forks source link

SSH handshake fails with openstack provider #32886

Closed alpana17 closed 1 year ago

alpana17 commented 1 year ago

Terraform Version

0.12.7
openstack provider version: 1.27.0

Terraform Configuration Files

===============================

Deploying Openstack Instance

===============================

Connect to Openstack

provider "openstack" { version = "1.27.0" user_name = "USER" tenant_name = "Ima*ory" tenant_id = "*****" password = "**" auth_url = "https://or1lab-openstack..com:5000/v3" region = "uswestorlab1" user_domain_name ="***net" }

resource "openstack_compute_keypair_v2" "dj-keypair" { name = "os_update-keypair" public_key = "${file("./ssh-key.pub")}" }

resource "openstack_compute_instance_v2" "ifcicd-alsingha-openstack-test" { name = "ifcicd-alsingha-ubuntu" image_name = "Ubuntu2204-IF-20221018" key_pair = "${openstack_compute_keypair_v2.dj-keypair.name}" flavor_name = "m4.small" security_groups = ["default"] availability_zone = "uswestorlab1"

network { name = "provider_net_3207" access_network = true }

connection { host = "${openstack_compute_instance_v2.ifcicd-alsingha-openstack-test.access_ip_v4}" user = "ubuntu" private_key = "${file("./ssh-key")}" }

provisioner "local-exec" { command = "echo ${openstack_compute_instance_v2.ifcicd-alsingha-openstack-test.access_ip_v4} > ip_address_linux.txt" }

provisioner "remote-exec" { inline = [ "mkdir -p test_case_path/remote", "mkdir -p test_case_path/output", "mkdir -p test_case_path/reports" ] }

}

Debug Output

Terraform launched the vm. But not able to connect to vm via ssh. If I try to login to vm manually, then I can.

With terraform, it just tries to ssh multiple times and fails with timeout error: image

Expected Behavior

Terraform must ssh into the launched vm

Actual Behavior

Terraform launched the vm. But not able to connect to vm via ssh. If I try to login to vm manually, then I can.

With terraform, it just tries to ssh multiple times and fails with timeout error:

image

Steps to Reproduce

terraform init terraform apply

Additional Context

No response

References

No response

alpana17 commented 1 year ago

I tried like this also: `provider "openstack" { version = "1.27.0" user_name = "im*aker" tenant_name = "Im*****ory" tenant_id = "*****" password = "*" auth_url = "https://or1lab-openstack.********.com:5000/v3" region = "uswestorlab1" user_domain_name ="a****et" }

resource "openstack_compute_keypair_v2" "dj-keypair" { name = "os_update-keypair" public_key = "${file("./ssh-key.pub")}" }

resource "openstack_networking_port_v2" "port_1" { name = "port_1" admin_state_up = "true"

network_id = "216b5228-6690-4f58-ab07-46f2e5863117"

security_group_ids = [ "1c988dec-715d-4a21-8cbf-fa3b050b1f06", ] }

resource "openstack_compute_instance_v2" "instance_1" { name = "instance_1" image_name = "Ubuntu2204-IF-20221018" key_pair = "${openstack_compute_keypair_v2.dj-keypair.name}" flavor_name = "m4.small"

network { port = "${openstack_networking_port_v2.port_1.id}" }

connection { user = "ubuntu" host = "${openstack_networking_port_v2.port_1.all_fixed_ips.0}" private_key = "${file("./ssh-key")}" }

provisioner "remote-exec" { inline = [ "mkdir -p test_case_path/remote", "mkdir -p test_case_path/output", "mkdir -p test_case_path/reports" ] }

`

Still same issue

jbardin commented 1 year ago

Hello,

We use GitHub issues for tracking bugs and enhancements, rather than for questions. While we can sometimes help with certain simple problems here, it's better to use the community forum where there are more people ready to help.

Thanks!

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.