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

PreviousPage 5 of 5

@dave-dittrich The goods news is that I can tell you the terraform openapi provider latest release works for me.

Just to try to avoid confusion about "current OS", my antsle is running antsleOS 2.0.0 and antman 3.4.3, which I think is the latest based on when I run "upgrade-edgelinux" and "upgrade-antman", no newer version is downloaded; in fact, running "upgrade-edgelinux" results in "You are running the latest edgeLinux version."

root@antsle:~ # antsleOS-version
2.0.0
root@antsle:~ # antman-version
3.4.3

I also don't own a Mac so I can't replicate your exact setup with the darwin binary, but the following worked for me on my linux laptop:

➜ test ls -l
total 20
-rw-r--r-- 1 brad brad 592 Jul 22 06:34 inputs.tf
-rw-r--r-- 1 brad brad 212 Jul 22 06:38 main.tf
-rw-r--r-- 1 brad brad 19 Jul 22 06:39 medium.tfvars
-rw-r--r-- 1 brad brad 182 Jul 22 06:33 provider.tf
-rw-r--r-- 1 brad brad 46 Jul 22 06:46 version.tf
➜ test cat provider.tf
terraform {
required_providers {
antsle = {
source = "localhost/antsle/antsle"
version = ">= 3.0.0"
}
}
}

provider "antsle" {
api_key = var.apikey_auth
}
➜ test cat main.tf
resource "antsle_antlets" "tfantlet" {
dname = "tfantlet"
template = var.template
ram = var.ram
cpu = var.cpu
antlet_num = 33
zpool_name = "antlets"
compression = "lz4"
}
➜ test ls ~/.terraform.d/plugins/localhost/antsle/antsle/3.0.0/linux_amd64
terraform-provider-antsle
➜ test md5sum ~/.terraform.d/plugins/localhost/antsle/antsle/3.0.0/linux_amd64/terraform-provider-antsle
b91bab580ebdbdff94963d0be2abe76a /home/brad/.terraform.d/plugins/localhost/antsle/antsle/3.0.0/linux_amd64/terraform-provider-antsle
➜ test ls ~/.terraform.d/plugins/
localhost terraform-provider-openapi.yaml
➜ test terraform version
Terraform v1.2.5
on linux_amd64
➜ test terraform init

Initializing the backend...

Initializing provider plugins...
- Finding localhost/antsle/antsle versions matching ">= 3.0.0"...
- Installing localhost/antsle/antsle v3.0.0...
- Installed localhost/antsle/antsle v3.0.0 (unauthenticated)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

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.
➜ test terraform apply -var apikey_auth="Token <ACTUAL_TOKEN_REDACTED>"

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create

Terraform will perform the following actions:

# antsle_antlets.tfantlet will be created
+ resource "antsle_antlets" "tfantlet" {
+ antlet_num = 33
+ autostart = (known after apply)
+ compression = "lz4"
+ cpu = 2
+ dname = "tfantlet"
+ dtype = (known after apply)
+ id = (known after apply)
+ ip = (known after apply)
+ ram = 4096
+ ram_display = (known after apply)
+ state = (known after apply)
+ storage_display = (known after apply)
+ template = "CentOS-7"
+ uuid = (known after apply)
+ zfs_quota = (known after apply)
+ zpool_name = "antlets"

+ zpool {
+ antsle_managed_origin = (known after apply)
+ capacity = (known after apply)
+ compression = (known after apply)
+ health = (known after apply)
+ mounted = (known after apply)
+ mountpoint = (known after apply)
+ name = (known after apply)
+ size = (known after apply)
}
}

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.

Enter a value: yes

antsle_antlets.tfantlet: Creating...
antsle_antlets.tfantlet: Creation complete after 8s [id=tfantlet]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
➜ test

That was with the latest Terraform (1.2.5), what I think is the latest antsleOS ant antman, and the latest open-api-provider I download straight from the github releases (I ran md5sum sum if you wanted to compare). I updated the folder path and provider.tf to match the version of the provider I was using, but apart from that, there wasn't any extra magic I did.

My gut says to investigate your terraform-provider-openapi.yaml file. You have your antlse's address of 192.168.0.20:3000 in it? A difference in our approaches is that I'm using https via Antsle's domain registration capability. Without this, it might be possible that terraform is communicating to your Antsle's API fine, but it's hitting a "website is unsafe" or "warning: self signed cert" roadblock that the provider can't gracefully handle, depending on whether or not you put http or https into your yaml file. How is that file instructing terraform to communicate with your Antman? I'd try it again with the HTTPS setup for a registered domain first and see if that plays nicer for you.

If it doesn't, since the debug logs aren't producing any leads, can you produce the command-line output similar to mine above that shows all of your folder paths/names and key file contents, etc? Obviously, censor/omit your token.

 

daniel.luck has reacted to this post.
daniel.luck
PreviousPage 5 of 5