Skip to content

Add a new action

Iván Corrales Solera edited this page Feb 18, 2021 · 1 revision

Add a new action

Steps

  • Create a new folder for the action
mkdir actions/<action>
  • Let's create the files in the folder: action.go and decoder.go

action.go It contains the definition for our action. This struct must implement interface Action.

type MyAction struct {
  *actions.Base
  name  string
  index hcl.Expression
  value hcl.Expression
}

decoder.go It must contain an implementation of the interface Decoder.

Complex actions.

action {
  attribute1 =""
  attribute2 =""
  block {
  
  }
   
}

In case of we need to create an action that is composed of attributes but also by subblocks, we will need to define new structs. To do this, we can have a look at the implementation of action HTTP that make uses of the internal directory.

Clone this wiki locally