Guest User

Untitled

a guest
Aug 20th, 2019
93
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Error: Reference to "count" in non-counted context
  2.  
  3. on main.tf line 33, in data "aws_subnet" "public":
  4. 33: id = data.aws_subnet_ids.public.ids[count.index]
  5.  
  6. The "count" object can be used only in "resource" and "data" blocks, and only
  7. when the "count" argument is set.
  8.  
  9. data "aws_subnet_ids" "public" {
  10. vpc_id = data.aws_vpc.vpc.id
  11.  
  12. tags = {
  13. Tier = "public"
  14. }
  15. }
  16.  
  17. data "aws_subnet" "public" {
  18. id = data.aws_subnet_ids.public.ids[count.index]
  19. }
  20.  
  21. data "aws_subnet_ids" "public" {
  22. vpc_id = data.aws_vpc.vpc.id
  23.  
  24. tags = {
  25. Tier = "public"
  26. }
  27. }
  28.  
  29. data "aws_subnet" "public" {
  30. for_each = data.aws_subnet_ids.public.ids
  31.  
  32. id = data.aws_subnet_ids.public.ids[count.index]
  33. }
  34.  
  35. data "aws_subnet_ids" "public" {
  36. vpc_id = data.aws_vpc.vpc.id
  37.  
  38. tags = {
  39. Tier = "public"
  40. }
  41. }
  42.  
  43. data "aws_subnet" "public" {
  44. count = length(data.aws_subnet_ids.public.ids)
  45.  
  46. id = sort(data.aws_subnet_ids.public.ids)[count.index]
  47. }
RAW Paste Data