Antsle Forum

Welcome to our Antsle community! This forum is to connect all Antsle users to post experiences, make user-generated content available for the entire community and more. 

Please note: This forum is about discussing one specific issue at a time. No generalizations. No judgments. Please check the Forum Rules before posting. If you have specific questions about your Antsle and expect a response from our team directly, please continue to use the appropriate channels (email: [email protected]) so every inquiry is tracked. 

Please or Register to create posts and topics.

Terraform Provider Plugin

Using the swagger-ui shows the exact same NullPointerException in antmand 🙁    Some other POST API work fine in swagger-ui (like antlets start and stop) but this /api/antlets API seems to have issues.

It works ... finally.    Unfortunately, the Antsle Terraform Provider example here: https://github.com/antsle/antsle-terraform-provider-example/ ... is wrong about the ram.  That should not be in Kbytes.  This 2018 Antsle Forum post got me working correctly:

https://antsle.com/forum/topic/curl-could-not-zfs-clone-for-antlet-testserver1/

My working Terraform config looks like this:

provider "antsle" {
api_key = "Token eyJh....."
version = "0.31.1"
}

resource "antsle_antlets" "seanterra" {
antlet_num = "50"
dname = "seanterra"
template = "CentOS-7.1.lxc"
zpool_name = "antlets"
compression = "off"
ram = 1
cpu = 1
}

You do not need to setup SSL on Anthill for your Antsle.  You can create a self-signed cert for the Nginx on your Antsle for that.  Simply uncomment the TLS server section of the nginx.conf file and add in this:

location ~ ^/(swagger-ui|swagger.json|api)? {
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:3000;
}

When setting up your Terraform provider in the terraform-provider-openapi.yaml file, it needs the "insecure_skip_verify: true" as shown below as this is using a self-signed certificate.  The swagger-url should point to your Antsle Nginx controlled port 443/tcp URL as shown below in my example.

version: 1
services:
antsle:
swagger-url: https://antsleone.lan/swagger.json
insecure_skip_verify: true

And just for reference this recent 2020 video on the Antman API helped some as well: https://www.youtube.com/watch?v=dChdVIvP7zA&feature=youtu.be

Hoping at some point the documentation for the Antman API specification is tightened up indicating which arguments are required, what value setups they require (like "ram" !!! 🙂 )

Quote from soneill on August 9, 2020, 8:37 pm

It works ... finally.    Unfortunately, the Antsle Terraform Provider example here: https://github.com/antsle/antsle-terraform-provider-example/ ... is wrong about the ram.  That should not be in Kbytes.  This 2018 Antsle Forum post got me working correctly:

@soneill - where did you see the plugin asking for KB? It should all be MB.

Thanks!

One example is here:

https://docs.antsle.com/system/using-the-antman-rest-api-with-terraform

The other example is here:

https://github.com/antsle/antsle-terraform-provider-example/

The hard part here is the error you get is a NullPointerException in the antman log.

 

@soneill This is referring to MB not KB - I don't see it mention KB anywhere. Maybe the example is confusing since it says 1024? - That would make sense.

@marc - anything we can do to improve that error handling?

Uploaded files:
  • Screen-Shot-2020-08-10-at-2.30.12-PM.png

My math is all wrong !! 🙂  Actually my post is wrong.   I just tried 1024 again and it worked.   So, my apologies on the false positive posting.

Just tried it again but removed the "antlet_num" value.  And I got the null pointer again.  Is there anyway to update the provider error handling to throw an error saying that value is required vs a nullpointer ?

Back again to re-attempt this configuration with the latest Antman release!

I submitted a PR to the terraform-provider-openpi to address the provider's inability to handle the colon (":") characters in Antsle's APIs. Dikhan made some suggestions to remove the colon characters and or the "antsle" strings from the offending APIs to avoid redundancy, if the Antsle team is interested.

My changes are compatible with Antman 3.4.1's API and terraform 0.15.5. I'm likely going to try to submit another PR to support terraform > 1.0.0 as well. When all of the dust settles, I'll share a braindump so others can replicate what is working for me.