Bootstrapping using terraform in openstack - personality issues

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Bootstrapping using terraform in openstack - personality issues

L1 Bithead

 I am trying to automate a vm inside openstack in our Ocata environment using terraform.  But I am having issues using the personality when i am building the instance.   Using heat template the snippet of the code is as follows.

 

### Heat   ####

user_data_format: RAW
config_drive: true
personality:
/config/init-cfg.txt: {get_file: "/root/bootstrap/config/init-cfg.txt"}
/config/bootstrap.xml: {get_file: "/root/bootstrap/config/bootstrap.xml"}

 

But in terraform, i cannot find a similar way of setting the personality function.   So this is what I tried to use:

 

resource "openstack_compute_instance_v2" "pan81" {
# count = "${var.count}"
name = "pan01"
image_name = "PAN81"
flavor_name = "p1.large"
key_pair = "${var.openstack_keypair}"
security_groups = ["default"]
config_drive = "true"

metadata {
instance_test = "pan image"
}
network {
name = "terra-mgmt"
}

network {
name = "terra-north"
}
network {
port = "${openstack_networking_port_v2.terra-south-port.id}"
}
personality {
file = "init-cfg.txt"
contents = "/config/init-cfg.txt"
}


Terraform Error:


* openstack_compute_instance_v2.cirros: "personality.0.content": required field is not set
* openstack_compute_instance_v2.cirros: personality.0: invalid or unknown key: contents

Does anyone know how to properly configure the personality block inside the resource "openstack_compute_instance_v2"?

3 REPLIES 3

L5 Sessionator

Looks you're using the Openstack terraform provider there..  I don't know anything about it, but Palo Alto Networks does have a terraform provider now.  Would using it fit your use case?  It was just updated last week to add Panorama support.

 

Here's the documentation for it (you just need to do terraform init in a directory that has a panos resource to get the provider itself):

https://www.terraform.io/docs/providers/panos/index.html

I am also using the pan provider but the issue with using the pan provider is that when an instance is being built in openstack,  the pan provider is also called and fails.  The pan provider is best when the instance is already reachable and built.

 

 

Ah, yes.  This is a Terraform thing, where they aren't good at "use this provider only after this other provider has provisioned it."

  • 3528 Views
  • 3 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!