Secret manager in Packer

116 views
Skip to first unread message

Gowtham

unread,
Jan 29, 2021, 7:06:24 AM1/29/21
to packe...@googlegroups.com
Team, 

Am using variables block to get the secret from the secret manager and which is working fine. When my secrets having multiple keys it's not able to fetch the correct one.  I've tried to mention the key ( example vsphere_passwd) while calling the secrets in variable but it's not working. 

My initial code is:(Pasted only the relevant section)

"variables": {
"vsphere_uid" : "{{ aws_secretsmanager `vsphere_service_account` }}",
"vm_superuser_passwd" : "{{ aws_secretsmanager (`vm-superuser-password`, `password`) }}",
}

➜  git:(packer/centos7) ✗ PACKER_LOG_PATH="packerlog.txt" PACKER_LOG=1 AWS_REGION=us-east-1 packer build -var 'vsphere_vm_name=test' centos7.json
Error initializing core: error interpolating default value for 'vm_superuser_passwd': template: root:1: unexpected "," in operand


After following https://www.packer.io/docs/from-1.5/functions/contextual/aws_secretsmanager, have tried to use the local but which is throwing an "Unknown root level key".

The code is : (Pasted only the relevant section)
```
"locals": {
"secret" : "{{ aws_secretsmanager(\"vm-user-password\", \"password\") }}"
},

The error is : 
```
➜  onprem_packer git:(packer/centos7) ✗  AWS_REGION=us-east-1 packer build  -var 'vsphere_vm_name=test' centos7.json
Failed to parse template: 1 error occurred:
* Unknown root level key in template: 'locals'

==> Builds finished but no artifacts were created.
➜  onprem_packer git:(packer/centos7) ✗ packer --version
1.5.6
```


Any suggestions?

---
Best regards,
Gowtham
07798838879 


=====================
Learn from mistakes....

Please consider the environment before printing this email - Thanks

Gowtham

unread,
Feb 3, 2021, 12:54:43 AM2/3/21
to packe...@googlegroups.com
This has been fixed in the newer versions. I've tested using 1.6.4 and which is working perfectly.

---
Best regards,
Gowtham
07798838879 


=====================
Learn from mistakes....

Please consider the environment before printing this email - Thanks

Reply all
Reply to author
Forward
0 new messages