Forum Discussion
Terraform AS3 code for GTM Only.
Hello All,
I am really really suffering here :(
Have been looking for GTM ONLY code in AS3 form, need a simple code hardcoded values will also work.
I have seen documentation and couldn't see exact use case. We are doing POC for where VMs are direct;y added to GTM and NO LTM component are there.
I can't post my LTM + GTM code as its in office.
Would really appreciate any help and guidance here. Any simple code work snippet using only AS3 please.
9 Replies
- Jeff_Granieri
Employee
Hi RavinderSingh13 ,
There are many example AS3 code snippets AS3 GTM Here are some simple GTM AS3 snippets you can play with:
{ "class": "AS3", "declaration": { "class": "ADC", "schemaVersion": "3.40.0", "id": "gtm-minimal", "tenant": { "class": "Tenant", "Common": { "class": "Application", "dns_listener": { "class": "DNS_Listener", "address": "0.0.0.0", "port": 53 }, "dc1": { "class": "GTM_DataCenter" }, "server1": { "class": "GTM_Server", "dataCenter": "dc1", "devices": [{ "address": "10.1.1.1" }], "virtualServers": [ { "name": "vs1", "address": "203.0.113.10", "port": 80 } ] }, "pool1": { "class": "GTM_Pool", "members": [ { "server": "server1", "virtualServer": "vs1" } ] }, "app_com": { "class": "GTM_WideIP", "domainName": "app.example.com", "pools": [{ "use": "pool1" }] } } } } } - RavinderSingh13
Altocumulus
Thanks a TON Jeff_Granieri GOD bless you. I have following questions here:
1- Will this code snippet create VM instances in GTM? Because we don't want to point to existing vm instances in F5. AS I don't have LTM layer at all. Its GTM Only.
2- For payload fields I need to check my configs in F5 UI? Eg: what will be value of `class` field for app_com is it always GTM_WideIP? Sorry I am new to F5 so not sure at all on this one.
Will be grateful to you for your help and guidance, cheers.
- Jeff_Granieri
Employee
If your looking for a initial VM setup you need to have the base VM setup, networking , resources , and a deployed BIG-IP with a license. Provided you have a BIG-IP running on a VM you can leverage DO - Declarative Onboarding to help get things setup.
- Download the latest DO RPM from GitHub: https://github.com/F5Networks/f5-declarative-onboarding/releases (e.g., f5-declarative-onboarding-1.x.x-x.noarch.rpm).
- Access the BIG-IP GUI at https://<management-ip>.
- Navigate to iApps > Package Management LX.
- Click Import, select the RPM file, and click Upload. Wait for the installation to complete (check status).
- Verify: In the CLI (SSH as root), run tmsh list sys software or check the iApps page for "f5-declarative-onboarding"
- your going to need to amend various field below for your dsetup - IP.s keys,dns,ntp, admin accounts, self ip's etc
{ "schemaVersion": "1.0.0", "class": "Device", "async": true, "label": "Onboard BIG-IP VE for GTM/DNS", "Common": { "class": "Tenant", "mySystem": { "class": "System", "hostname": "gtm-bigip.example.com", "cliInactivityTimeout": 1200, "consoleInactivityTimeout": 1200, "autoPhonehome": false }, "myLicense": { "class": "License", "licenseType": "regKey", "regKey": "AAAAA-BBBBB-CCCCC-DDDDD-EEEEEEE" }, "myDns": { "class": "DNS", "nameServers": [ "8.8.8.8", "2001:4860:4860::8844" ], "search": [ "example.com" ] }, "myNtp": { "class": "NTP", "servers": [ "0.pool.ntp.org", "1.pool.ntp.org", "2.pool.ntp.org" ], "timezone": "UTC" }, "root": { "class": "User", "userType": "root", "oldPassword": "default", "newPassword": "newRootPassword123" }, "admin": { "class": "User", "userType": "regular", "password": "newAdminPassword123", "shell": "bash" }, "myProvisioning": { "class": "Provision", "ltm": "nominal", "gtm": "nominal" }, "internal": { "class": "VLAN", "tag": 4093, "mtu": 1500, "interfaces": [ { "name": "1.2", "tagged": true } ] }, "internal-self": { "class": "SelfIp", "address": "10.10.0.100/24", "vlan": "internal", "allowService": "default", "trafficGroup": "traffic-group-local-only" }, "external": { "class": "VLAN", "tag": 4094, "mtu": 1500, "interfaces": [ { "name": "1.1", "tagged": true } ] }, "external-self": { "class": "SelfIp", "address": "10.20.0.100/24", "vlan": "external", "allowService": "none", "trafficGroup": "traffic-group-local-only" }, "default": { "class": "Route", "gw": "10.10.0.1", "network": "default", "mtu": 1500 } } }curl -k -u admin:admin -H "Content-Type: application/json" -X POST https://<management-ip>/mgmt/shared/declarative-onboarding -d @do-declaration.json
- RavinderSingh13
Altocumulus
Hello Jeff_Granieri, Thanks a lot for your reply 👍
Sorry to say but I can't use curl command :(
It should be:
1- All the code should be in AS3 only; can't make curl calls :( since we are using terraform code to create resources.
2- Then VMs instances from F5 side should be created in GTM directly we don't want actual VMs to be created.
3- LTM layer is not there so VMs instance(from F5 side) should be added directly into GTM itself.
I apologies if there are any confusions but I tried my best to write code but couldn't, every time it expects VM instances to be present in F5 already, so not sure how to do this. Will be grateful for your guidance here, cheers and Happy Saturday.
- RavinderSingh13
Altocumulus
- Jeff_Granieri
Employee
For initial BIG-IP VE setup on a VM you would need to use Declarative Onboarding or manually setup your BIG-IP. Once you have the basic items setup (License, MGT IP, ntp/dns/ etc..) then you can then leverage AS3 to configure GTM elements. There is GH repo dedicated to DO should you want to use it: https://github.com/F5Networks/f5-declarative-onboarding.f
- RavinderSingh13
Altocumulus
Hello Jeff_Granieri Good morning.
Sorry but that repo is not working. I Apologies I am NOT a F5 person but want to do automation in Terraform AS3 for GTM only. Will be really grateful sir if you could guide me on this one, cheers.
- RavinderSingh13
Altocumulus
Hello Jeff_Granieri Greetings.
I have created following code in terraform to create DC, GTM and then VM instances in them.
This works fine for creating things from Scratch but have issues mentioned below.
resource "bigip_as3" "gtm_configuration" { provider = bigip.burwoodgtm as3_json = jsonencode({ class = "AS3" action = "deploy" persist = true declaration = { class = "ADC", schemaVersion = "3.41.0", id = "GSLB_Sample", Common = { class = "Tenant", Shared = { class = "Application", template = "shared", testDataCenter = { class = "GSLB_Data_Center" } testServer = { class = "GSLB_Server", dataCenter = { use = "testDataCenter" }, devices = [ { address = "1.2.3.7" } ], virtualServers = [ { address = "1.2.3.8", port = 5050, name = "virtualAddress1" }, { address = "1.2.3.9", port = 5051, name = "virtualAddress2" } ] } } } } }) }Problem is its creating everything from Scratch and NOT adding/appending VM instances inside existing DC and GTM.
Could you please do help me here?
- RavinderSingh13
Altocumulus
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
