sparkleformation / sfn

SparkleFormation CLI
http://www.sparkleformation.io
Apache License 2.0
63 stars 24 forks source link

Documentation needs examples of --compile-parameters and --interactive-parameters options #213

Closed mfischer-zd closed 6 years ago

mfischer-zd commented 8 years ago

I cannot figure out what format the operands of the --compile-parameters and --interative-parameters options are supposed to be, and there are no examples in the documentation.

endzyme commented 7 years ago

having the same problem and they don't work in updates

moatazelmasry2 commented 6 years ago

Is --interactive-parameters working at all? I tried False/false/FALSE/no/NO nothing works!

jimcroft commented 6 years ago

For --compile-parameters does the same format as --parameters not work? eg.

sfn … --compile-parameters Key1:Value1,Key2:Value2,etc

Regarding --interactive-parameters the valid values should be either true or false.

avi-kalar commented 6 years ago

I have been trying a sfn print command, but that doesn't seem to be working sfn print --file template -w output.json --compile-parameters environment_name:dev

:compile_time_parameters => {
    :environment_name => {
      :type => :string,
      :default => 'dev',
      :allowed_values => ['dev','int'],
      :description => 'Default env value'
    }
   }
chrisroberts commented 6 years ago

Hi! Sorry for the delay in responding to this. Boolean flags do not take a value. So to enable interactive parameters, the flag is --interactive-parameters. To disable it, it is --no-interactive-parameters.

So, given this template:

SparkleFormation.new(:test, compile_time_parameters: {environment_name: {type: 'string', allowed_values: ['dev', 'prod'], default: 'dev'}}) do
  parameter.environment.value state!(:environment_name)
end

we can run:

$ sfn print --file test --no-interactive-parameters
{
  "Parameter": {
    "Environment": {
      "Value": "dev"
    }
  },
  "Outputs": {
    "CompileState": {
      "Value": "{\"environment_name\":\"dev\"}"
    }
  }
}

and to define update the value on the CLI:

$ sfn print --file test --no-interactive-parameters --compile-parameters environment_name:prod
{
  "Parameter": {
    "Environment": {
      "Value": "prod"
    }
  },
  "Outputs": {
    "CompileState": {
      "Value": "{\"environment_name\":\"prod\"}"
    }
  }
}

If you're still having problems, just let me know and we can re-open this. Cheers!