Code Monkey home page Code Monkey logo

Comments (2)

raoulmillais avatar raoulmillais commented on September 15, 2024

Confirmed. simulator infra create shows the change of the keypair in the tf plan output but you still cannot ssh onto the bastion with ssh -F ~/.ssh/cp_simulator_config bastion

log output
------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform will perform the following actions:

module.SshKey.aws_key_pair.simulator_bastion_key must be replaced

-/+ resource "aws_key_pair" "simulator_bastion_key" {
~ fingerprint = "cf:83:f8:ee:09:14:9f:99:b2:4e:9b:e6:35:95:ea:d5" -> (known after apply)
~ id = "simulator_bastion_access_key-108cf826-1bec-89c9-35b1-80a9bd4f7c56" -> (known after apply)
key_name = "simulator_bastion_access_key-108cf826-1bec-89c9-35b1-80a9bd4f7c56"
~ public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOdlZr+QS+EPQVpoHFzGP/5s3H2rA1oH/1Ee7c3NkNrX+Q/z3IwceG/416Q6h3kc5aZq3MxYy69XHeYyMa1z0e/589XLZt7Dow9rjcwtkq99aeGzbYumzQ8Dm/tj+W+fw7xJHNuqICkxZgesN9uORjF5T8/4r888UxTTBv2LzvFzMsnQTXwnEC6OPwbfSJEpYev4Lfo2bli+aML7VE3Ea4DTxUJR4Fq4XBC5g2543iSmLK6CJqzID2UsDNjFfINzHdNvNwE061FgdO3xLZDdZi1EqOIO26fMH+wIcG4PlDMkdTZsTTJVuI9RqqpwPba8R5+nbvwtU9LgoNTwky4EgZ simulator-key" -> "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwbrmsmYpn1Kj6TYkl3O3X+2ksWNegctfEkEhWm620ypf4d5ilKjs9FuiL3X2LQKEllgNz7rNbNioDAATxrQh26d6VF9Pjzt1qBO20I/KnRI0jDT8x6FTe5x/KQp5B2H5oG81hjUFqVbjNGXZ/MNdhFtvt0Ktbu+OcnhHMbhBOQHDP0hYBrM6upbLGbQSg7ObghPBZBWOYvTXTYfKCpqm/MOQ/uAuysp/3qPkIUm/zuqClX2hlr3MGKaIl0EyjSTQ2ysj9IBQWz0qlrGgwT8/ytZiHGXp+3TB6CqJMlWzdb77AlVST5Swli6U+7TyU28nHHwfS6k8DT9o/tmC3GKtd simulator-key" # forces replacement
}

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


Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.

1.5740714523900445e+09 INFO simulator/terraform.go:105 Running terraform apply
module.InternalNode.data.template_file.internal_config: Refreshing state...
module.Bastion.data.template_file.goss_template: Refreshing state...
module.SshKey.random_uuid.key_uuid: Refreshing state... [id=108cf826-1bec-89c9-35b1-80a9bd4f7c56]
module.S3Storage.random_uuid.s3_iam_role_uuid: Refreshing state... [id=738802b4-d259-5e75-3f01-86d3816dd89b]
module.SecurityGroups.random_uuid.unique: Refreshing state... [id=fda0118b-8f42-7915-6d1a-e7fc23666b28]
module.S3Storage.aws_iam_role.simulator_s3_access_role: Refreshing state... [id=simulator-s3-host-role-738802b4-d259-5e75-3f01-86d3816dd89b]
module.SshKey.aws_key_pair.simulator_bastion_key: Refreshing state... [id=simulator_bastion_access_key-108cf826-1bec-89c9-35b1-80a9bd4f7c56]
module.Networking.aws_vpc.simulator_vpc: Refreshing state... [id=vpc-04f2bce6e0abb4487]
module.Ami.data.aws_ami.find_ami: Refreshing state...
module.Networking.data.aws_availability_zones.available: Refreshing state...
module.S3Storage.aws_s3_bucket.k8sjoin: Refreshing state... [id=k8sjoin-738802b4-d259-5e75-3f01-86d3816dd89b]
module.S3Storage.aws_iam_instance_profile.simulator_instance_profile: Refreshing state... [id=simulator-instance-profile-738802b4-d259-5e75-3f01-86d3816dd89b]
module.Networking.aws_internet_gateway.simulator_igw: Refreshing state... [id=igw-08548a3c12be95ebf]
module.Networking.aws_subnet.simulator_private_subnet: Refreshing state... [id=subnet-0610c296b180f945e]
module.Networking.aws_subnet.simulator_public_subnet: Refreshing state... [id=subnet-07a51b55573979c50]
module.SecurityGroups.aws_security_group.simulator_bastion_sg: Refreshing state... [id=sg-017b4e79808370b3a]
module.Networking.aws_route_table.simulator_public_route_table: Refreshing state... [id=rtb-0c07546bc8053abc1]
module.Networking.aws_eip.simulator_eip: Refreshing state... [id=eipalloc-051a5f84bf85f77ff]
module.SecurityGroups.aws_security_group.simulator_controlplane_sg: Refreshing state... [id=sg-0e8cd3be9075f331c]
module.S3Storage.aws_iam_role_policy.simulator_s3_access_policy: Refreshing state... [id=simulator-s3-host-role-738802b4-d259-5e75-3f01-86d3816dd89b:simulator-s3-host-policy-738802b4-d259-5e75-3f01-86d3816dd89b]
module.Kubernetes.data.template_file.node_cloud_config[1]: Refreshing state...
module.Kubernetes.data.template_file.master_cloud_config[0]: Refreshing state...
module.Kubernetes.data.template_file.node_cloud_config[0]: Refreshing state...
module.Networking.aws_route_table_association.simulator_public_rt_assoc: Refreshing state... [id=rtbassoc-0e8d95e4673d71d6b]
module.Networking.aws_nat_gateway.simulator_nat: Refreshing state... [id=nat-0c8764e8c80d13a9f]
module.Kubernetes.aws_instance.simulator_master_instances[0]: Refreshing state... [id=i-00515d707a4f96b49]
module.InternalNode.aws_instance.simulator_internal_node: Refreshing state... [id=i-0c25d774856c32566]
module.Networking.aws_route_table.simulator_private_nat_route_table: Refreshing state... [id=rtb-0d2d9f1c639026cdf]
module.Networking.aws_route_table_association.simulator_private_rt_assoc: Refreshing state... [id=rtbassoc-026960221951c8c26]
module.Kubernetes.aws_instance.simulator_node_instances[0]: Refreshing state... [id=i-0000d1693bdeeb077]
module.Kubernetes.aws_instance.simulator_node_instances[1]: Refreshing state... [id=i-02b5d87a86534d1b3]
module.Bastion.data.template_file.cloud_config: Refreshing state...
module.Bastion.aws_instance.simulator_bastion: Refreshing state... [id=i-046cb5a7338a633d8]
module.Kubernetes.null_resource.master_test[0]: Refreshing state... [id=9085864517575605113]
module.Bastion.null_resource.bastion_test: Refreshing state... [id=2860406003400417719]
module.Kubernetes.null_resource.node_test[1]: Refreshing state... [id=8689840216351447857]
module.InternalNode.null_resource.internal_node_test: Refreshing state... [id=1356445063876130222]
module.Kubernetes.null_resource.node_test[0]: Refreshing state... [id=9022638417319321692]
module.SshKey.aws_key_pair.simulator_bastion_key: Destroying... [id=simulator_bastion_access_key-108cf826-1bec-89c9-35b1-80a9bd4f7c56]
module.SshKey.aws_key_pair.simulator_bastion_key: Destruction complete after 0s
module.SshKey.aws_key_pair.simulator_bastion_key: Creating...
module.SshKey.aws_key_pair.simulator_bastion_key: Creation complete after 0s [id=simulator_bastion_access_key-108cf826-1bec-89c9-35b1-80a9bd4f7c56]

Apply complete! Resources: 1 added, 0 changed, 1 destroyed.

Outputs:

access_cidr = 90.252.110.223/32
ami_id = ami-00622b440d92e55c0
bastion_public_ip = 18.130.186.86
cluster_nodes_private_ip = [
"172.31.2.235",
"172.31.2.58",
]
internal_node_private_ip = 172.31.2.194
master_nodes_private_ip = [
"172.31.2.125",
]
1.5740714708434284e+09 INFO simulator/terraform.go:50 Ensuring there is a simulator keypair
1.574071470843624e+09 INFO simulator/terraform.go:56 Detecting your public IP address
1.5740714709834075e+09 INFO simulator/terraform.go:79 Running terraform init
Initializing modules...

Initializing the backend...

Initializing provider plugins...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

  • provider.aws: version = "~> 2.35"
  • provider.null: version = "~> 2.1"
  • provider.random: version = "~> 2.2"
  • provider.template: version = "~> 2.1"

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.
1.5740714740767958e+09 INFO simulator/terraform.go:118 Running terraform output
launch@launch:/app$ simulator ssh attack
1.574071538861147e+09 INFO simulator/terraform.go:50 Ensuring there is a simulator keypair
1.574071538861901e+09 INFO simulator/terraform.go:56 Detecting your public IP address
1.5740715396887617e+09 INFO simulator/terraform.go:79 Running terraform init
Initializing modules...

Initializing the backend...

Initializing provider plugins...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

  • provider.aws: version = "~> 2.35"
  • provider.null: version = "~> 2.1"
  • provider.random: version = "~> 2.2"
  • provider.template: version = "~> 2.1"

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.
1.5740715425646548e+09 INFO simulator/terraform.go:118 Running terraform output
1.5740715441702137e+09 INFO simulator/ssh.go:41 Keyscanning 18.130.186.86 and updating known hosts
1.5740715444518154e+09 INFO simulator/ssh.go:47 Connecting to%!(EXTRA string=18.130.186.86)
KeyFile
0x8408b0Connecting to 18.130.186.86
Failed to dial: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remainlaunch@launch:/app$
launch@launch:/app$ simulator ssh attack
1.5740715515774548e+09 INFO simulator/terraform.go:50 Ensuring there is a simulator keypair
1.574071551577853e+09 INFO simulator/terraform.go:56 Detecting your public IP address
1.5740715519189296e+09 INFO simulator/terraform.go:79 Running terraform init
Initializing modules...

Initializing the backend...

Initializing provider plugins...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

  • provider.aws: version = "~> 2.35"
  • provider.null: version = "~> 2.1"
  • provider.random: version = "~> 2.2"
  • provider.template: version = "~> 2.1"

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.
1.5740715545225449e+09 INFO simulator/terraform.go:118 Running terraform output
1.5740715566843545e+09 INFO simulator/ssh.go:41 Keyscanning 18.130.186.86 and updating known hosts
1.574071556968673e+09 INFO simulator/ssh.go:47 Connecting to%!(EXTRA string=18.130.186.86)
KeyFile
0x8408b0Connecting to 18.130.186.86
Failed to dial: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remainlaunch@launch:/app$
launch@launch:/app$
launch@launch:/app$ ssh -F ~/.ssh/cp_
cp_simulator_config cp_simulator_known_hosts cp_simulator_rsa cp_simulator_rsa.pub
launch@launch:/app$ ssh -F ~/.ssh/cp_simulator_
cp_simulator_config cp_simulator_known_hosts cp_simulator_rsa cp_simulator_rsa.pub
launch@launch:/app$ ssh -F ~/.ssh/cp_simulator_config bastion
[email protected]: Permission denied (publickey).
launch@launch:/app$ ssh -F ~/.ssh/cp_simulator_config bastion
[email protected]: Permission denied (publickey).

from simulator.

jondkent avatar jondkent commented on September 15, 2024

afaik you cannot re-provision the key (as this is done via cloud-init on the target host), and is therefore expected behaviour.

from simulator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.