shell-plugins icon indicating copy to clipboard operation
shell-plugins copied to clipboard

Move all provisioners that rely on changing the command line to the credential usage level

Open AndyTitu opened this issue 2 years ago • 2 comments

Platform or tool

ngrok, mysql, Akamai

Desired or expected behavior

No DefaultProvisioner modifies the command line. This is an easy step we could make for a couple of plugins right now, to make sure every plugin works as expected with the Terraform plugin.

A validation function would be a nice add-on, to make sure that default provisioners don't overwrite the command line in the future, until a better solution is available.

Current behavior

Plugins ngrok and mysql will not work with the Terraform plugin because plugins with multiple credentials ignore command line modification coming from a credential's DefaultProvisioner

What should be done

  1. For ngrok: we need to use the env var provisioner as the default provisioner while moving the provisioner which includes command line modifications to the credential usage level: in ngrok.go:
Uses: []schema.CredentialUsage{
			{
				Name: credname.Credentials,
                                Provisioner: // file provisioner init func here
			},
		},
  1. For mysql:

Build an env var provisioner and set is as the default provisioner while moving the file, command-line modifying provisioner to the executable > credential usage level (similarly to the above description for ngrok). Here are the env vars mysql is using: https://dev.mysql.com/doc/refman/8.0/en/environment-variables.html

  1. For Akamai:
DefaultProvisioner: provision.TempFile(configFile,
			provision.Filename(".edgerc"),
			provision.AddArgs(                               < // this should not be in the default provisioner but the specialised provisioner
				"--edgerc", "{{ .Path }}",              <
				"--section", "default",                  <
			),
			provision.SetPathAsEnvVar("EDGERC"), // for Akamai Terraform provider
		),

AndyTitu avatar May 16 '23 07:05 AndyTitu

I am happy to take this on.

arunsathiya avatar May 19 '23 14:05 arunsathiya

All of them are being tracked here individually:

  • https://github.com/1Password/shell-plugins/issues/274
  • https://github.com/1Password/shell-plugins/issues/277
  • https://github.com/1Password/shell-plugins/issues/278

I'll monitor and close this parent issue when all child issues are addressed.

arunsathiya avatar May 31 '23 03:05 arunsathiya