gophercloud icon indicating copy to clipboard operation
gophercloud copied to clipboard

How to use sub templates in 'stack.Create(c, opts)' function?

Open dayeguilaiye opened this issue 4 years ago • 1 comments

templates looks like:

/home/ubuntu/random-hash-code-path/heat.yaml:

......
type: subtemplate.yaml
......

And there is a subtemplate.yaml file in the same directory.

But the path is not the same as go program working directory, so I will get a error which tells me cannot find subtemplate.yaml.

So I tried to edit the stacks.Template.TE.Files (which is a map[string]string), like: {"subtemplate.yaml", "heat_template_version: "2013-05-23"..........."}

But I found it was overwrite to empty when executing stack.Create, so I got the same error.

Is there anyway to use sub template?

plus: the openstack HOT package is uploaded by our users, so the name of subtemplate.yaml is just a example, not certain file name.

dayeguilaiye avatar Sep 23 '21 03:09 dayeguilaiye

The Heat/Orchestration code isn't commonly used or well supported nowadays, so there isn't a lot of knowledge about how to apply it to different use-cases. I know Terraform has support for creating stacks, so it might be beneficial to review how it works:

  • https://github.com/terraform-provider-openstack/terraform-provider-openstack/blob/main/openstack/orchestration_stack_v1.go
  • https://github.com/terraform-provider-openstack/terraform-provider-openstack/blob/main/openstack/resource_openstack_orchestration_stack_v1.go
  • https://github.com/terraform-provider-openstack/terraform-provider-openstack/blob/main/openstack/resource_openstack_orchestration_stack_v1_test.go

jtopjian avatar Sep 24 '21 02:09 jtopjian