Is it possible to call provisioners from provider code?

I wonder if it’s possible to call provisioners like remote-exec from inside of provider code?

Yes:

    resource "aws_volume_attachment" "admin_rundeck" {
      device_name = "/dev/xvdf"
      instance_id = "${aws_instance....}"
      volume_id = "${aws_ebs_volume....}"

      depends_on = "..."

      connection {
        host = "....<domain name>"
        bastion_host = "${aws_instance.admin_jumpbox.public_ip}"
        timeout = "1m"
        key_file = "~/.ssh/admin.pem"
        user = "ubuntu"
      }

      provisioner "remote-exec" {
        script = "mount.sh"
      }

      provisioner "remote-exec" {
        inline = [
          "sudo service ..."
        ]
      }
    }

I meant from plugin’s code, not TF code.

Not as provisioners, no, their capabilities would need to be duplicated into the provider.

1 Like