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. 

You need to log in to create posts and topics.

Terraform Provider Plugin

12

This is really exciting. I'll try to find some time to play with it this week. If possible, I'll post some snippets as well.

Not to get too far ahead of ourselves, but an import (implementation docs) for the antsle_antlets module would be super handy, since most of us already have a good number of antlets to manage. 🙂

If I can, I may see if I can help with that and drop a PR.

Thanks to @ddmscott for the Terraform docs. I've been trying to use Terraform with the antsle today, and I've hit a wall. Maybe I'm overlooking something.

  1. I've installed terraform 0.12
  2. I've installed the OpenAPI provider plugin via the installation shell script; it is located at ~/.terraform.d/plugins/terraform-provider-antsle_v0.22.2
  3. I've put the terraform-provider-openapi.yaml file in the same directory, ~/.terraform.d/plugins/, as well, as per the Antsle Docs.
  4. I've put the sample project *.tf files in my home directory, from the Git Repo
  5. "terraform init" confirms that the antsle provider is installed and available
  6. "terraform plan" fails with "Error: Failed to instantiate provider "antsle" to obtain schema: Unrecognized remote plugin message:"

OpenAPI v022.2 is compatible with terraform 0.12, per the Git repo's release pages; I've tried v021.2 as well, with the same results. Without another entity to test the OpenAPI plugin against, I can't rule out that it's not a problem with the plugin, but I'm not thinking it's a plugin issue. Thinking it might have been terraform, I looked at its upgrade docs and ran "terraform 0.12upgrade" to ensure the sample project *.tf files were good, but I got the same error message.

Judging from the error message complaining about the schema, I'm thinking that the swagger.json file is throwing terraform for a loop, and it isn't being read correctly. Has anyone else encountered this error?

[email protected] ~ $ terraform version
Terraform v0.12.13
+ provider.antsle v0.22.2

[email protected] ~ $ ls .terraform.d/plugins
terraform-provider-antsle_v0.22.2 terraform-provider-openapi.yaml

[email protected] ~ $ cat .terraform.d/plugins/terraform-provider-openapi.yaml
version: 1
services:
antsle:
swagger-url: https://<myactualsubdomainthatI'veremovedfromthispost&gt;.antsle.us/swagger.json

[email protected] ~ $ cat provider.tf
variable "apikey_auth" {
default = "Token ey...>"
}

provider "antsle" {
apikey_auth = var.apikey_auth
}

brad@debian ~ $ cat antlet1.tf
resource "antsle_antlets" "antlet1" {
dname = "antlet1"
template = "Fedora.lxc"
ram = 1024
cpu = 1
antlet_num = 33
zpool_name = "antlets"
compression = "lz4"
}

[email protected] ~ $ terraform init

Initializing the backend...

Initializing provider plugins...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.antsle: version = "~> 0.22"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

[email protected] ~ $ terraform plan

Error: Failed to instantiate provider "antsle" to obtain schema: Unrecognized remote plugin message:

This usually means that the plugin is either invalid or simply
needs to be recompiled to support the latest protocol.

Hey @coby-stinson!

Thanks for reporting this! There seems to be an issue with the newer plugin versions and the antsle swagger-file.

For now, please try to use an older version (0.16 worked fine for me). You can download it here: https://github.com/dikhan/terraform-provider-openapi/releases/tag/v0.16.0 .

Just as you did with version 0.22, rename the downloaded plugin and place it in your plugin-directory (replace v0.22). You'll need to run terraform init in your project directory first to re-initialize after swapping the plugins, then try terraform plan again. Let me know how it goes!😊

We'll work on getting a fix out with one of the next antMan releases.

 

Cheers,

Marc

 

Thanks for the suggestion @mpbaum!

Unfortunately, that course of action yielded the same errors. I even downgraded terraform and mixed and matched versions to see if any combination worked, but no dice.

Tried:

  1. terraform_0.12.13 +{ OpenAPI_0.22.2, OpenAPI_0.21.2, OpenAPI_0.16.0, OpenAPI_0.15.0 } (Same error message)
  2. terraform_0.12.0 + { OpenAPI_0.22.2, OpenAPI_0.16.0, OpenAPI_0.15.0 } (Same error message)
  3. terraform_0.11.15-oci + { OpenAPI_0.22.2, OpenAPI_0.16.0, OpenAPI_0.15.0 } (Unable to parse *.tf files)

This may or may not be related, but I did notice that when I browsed to the swagger-ui page, after a few seconds of loading, an orange, "invalid" message box appeared in the bottom right hand corner of the page. Clicking on the message said something to the effect of my swagger.json file being unreachable. That made sense, because the Easy SSL method's DNS record maps the domain to my antsle's private IP, so of course swagger's external website is not going to be able to reach it unless I open up ports to let the comms through.

But it made me think to try adjusting the OpenAPI yaml file in the plugins directory and replace the domain name target point with "http://<privateIP>:3000/swagger.json". That wasn't useful either (browsing to that endpoint in the browser results in the same orange Invalid message.) So all I can think of is port forwarding my antlse to make it externally accessible to see if swagger validation passes, and if that's the culprit or not.

In any case, thanks again for the status update, Mr. Baum. I'm really looking forward to getting this tooling to hum.

12
powered by proof factor - increase conversions with social proof notifications