Skip to content

Commit

Permalink
annotate new vcl configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
aorith committed Oct 25, 2024
1 parent 0661785 commit 305b19a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/teclient/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ type VCLConfAPIModel struct {

type NewVCLConfAPIModel struct {
VCLCode string `json:"config_body"`
Comment string `json:"comment"`
}

// Certificates
Expand Down
5 changes: 5 additions & 0 deletions internal/teclient/vclconfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ func (c *Client) GetActiveVCLConf(environment APIEnvironment) (*VCLConfAPIModel,

func (c *Client) CreateVclconf(vclconf NewVCLConfAPIModel, environment APIEnvironment) (*VCLConfAPIModel, error) {
envpath := c.MustGetAPIEnvironmentPath(environment)

// Add a fixed comment to annotate that this configuration is being managed by terraform
// TODO: consider porting this to the state in the future
vclconf.Comment = fmt.Sprintf("Managed with %s", c.UserAgent)

req, err := c.prepareJSONRequest(vclconf, "POST", fmt.Sprintf("%s/v1/%s/%d/config/", c.HostURL, envpath, c.CompanyId))
if err != nil {
return nil, err
Expand Down

0 comments on commit 305b19a

Please sign in to comment.