enum variable type

2,128 views
Skip to first unread message

Mark Keisler

unread,
Dec 30, 2016, 1:05:38 PM12/30/16
to Terraform
Is there a way to emulate an enum type for a variable?  I want the plan/apply to blow up if the supplied variable value is not an "approved" value.

Paddy Foran

unread,
Jan 3, 2017, 12:23:06 PM1/3/17
to terrafo...@googlegroups.com
Hi!

Is that something that Schema.ValidateFunc could do for you? https://godoc.org/github.com/hashicorp/terraform/helper/schema#SchemaValidateFunc

Cheers,
Paddy

On Fri, Dec 30, 2016 at 10:05 AM, Mark Keisler <gri...@gmail.com> wrote:
Is there a way to emulate an enum type for a variable?  I want the plan/apply to blow up if the supplied variable value is not an "approved" value.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/ec48d426-17c5-4eaa-b4b7-59ef2a8cc91f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Keisler

unread,
Jan 3, 2017, 4:40:08 PM1/3/17
to Terraform
Maybe.  I'm not a Go developer. 

On Tuesday, January 3, 2017 at 11:23:06 AM UTC-6, Paddy Foran wrote:
Hi!

Is that something that Schema.ValidateFunc could do for you? https://godoc.org/github.com/hashicorp/terraform/helper/schema#SchemaValidateFunc

Cheers,
Paddy
On Fri, Dec 30, 2016 at 10:05 AM, Mark Keisler <gri...@gmail.com> wrote:
Is there a way to emulate an enum type for a variable?  I want the plan/apply to blow up if the supplied variable value is not an "approved" value.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.

Paddy Foran

unread,
Jan 3, 2017, 4:46:07 PM1/3/17
to terrafo...@googlegroups.com
Hi Mark,

I guess I'm confused about where you're trying to emulate it. Could you give me some more information?

Thanks!

Cheers,
Paddy

To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/1889fc6a-8703-42ce-831a-21ee024e8618%40googlegroups.com.

Mark

unread,
Jan 3, 2017, 6:13:06 PM1/3/17
to terrafo...@googlegroups.com
I'm trying to do this in my terraform config. I'd like a variable with a set of acceptable inputs, rejecting all others. 

Mark
(sent from mobile so forgive any typos)

You received this message because you are subscribed to a topic in the Google Groups "Terraform" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/terraform-tool/eRRWMS_1tcE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/CA%2BBw9Ch4xsKkEQdVRPpQgP8%2B7FkpgVPUpSB2cMOr01mUnOccjA%40mail.gmail.com.

Maxwell Flanders

unread,
Dec 6, 2017, 1:53:39 PM12/6/17
to Terraform
+1

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to a topic in the Google Groups "Terraform" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/terraform-tool/eRRWMS_1tcE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to terraform-too...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages