-
Notifications
You must be signed in to change notification settings - Fork 1
/
Aws.hs
3058 lines (2552 loc) · 152 KB
/
Aws.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{-# LANGUAGE OverloadedStrings #-}
-- | Terraform resource definitions
--
-- This file is auto-generated. Change it by changing the script
-- that generates it.
--
-- There are two variants of each function to construct a resource
-- (eg 'awsVpc' and 'awsVpc'') . The former takes the required attributes
-- as positional paramemeters. The latter (with the quote suffixed name)
-- takes a record containing all attributes. This can be more convenient
-- when there are many required arguments.
--
module Language.Terraform.Aws where
import qualified Data.Map as M
import qualified Data.Text as T
import Data.Maybe(catMaybes)
import Data.Monoid
import Language.Terraform.Core
type AwsRegion = T.Text
data AwsId a = AwsId
type CidrBlock = T.Text
type AvailabilityZone = T.Text
type Ami = T.Text
type InstanceType = T.Text
type KeyName = T.Text
type S3BucketName = T.Text
type S3Key = T.Text
type Arn = T.Text
newtype IpAddress = IpAddress T.Text
type VolumeType = T.Text
type CannedAcl = T.Text
type MetricComparisonOperator = T.Text
type MetricNamespace = T.Text
type MetricName = T.Text
type MetricStatistic = T.Text
type MetricUnit = T.Text
type DBEngine = T.Text
type DBInstanceClass = T.Text
type HostedZoneId = T.Text
type Route53RecordType = T.Text
-- | Add an aws provider to the resource graph.
--
-- See the original <https://www.terraform.io/docs/providers/aws/index.html terraform documentation>
-- for details.
newAws :: AwsParams -> TF ()
newAws params =
mkProvider "aws" $ catMaybes
[ Just ("region", toResourceField (aws_region params))
, let v = aws_access_key params in if v == "" then Nothing else (Just ("access_key", toResourceField v))
, let v = aws_secret_key params in if v == "" then Nothing else (Just ("secret_key", toResourceField v))
]
data AwsParams = AwsParams
{ aws_region :: AwsRegion
, aws_access_key :: T.Text
, aws_secret_key :: T.Text
}
makeAwsParams :: AwsRegion -> AwsParams
makeAwsParams region = AwsParams region "" ""
----------------------------------------------------------------------
-- | Add a resource of type AwsVpc to the resource graph.
--
-- See the terraform <https://www.terraform.io/docs/providers/aws/d/vpc.html aws_vpc> documentation
-- for details.
-- (In this binding attribute and argument names all have the prefix 'vpc_')
awsVpc :: NameElement -> CidrBlock ->(AwsVpcParams -> AwsVpcParams) -> TF AwsVpc
awsVpc name0 cidrBlock modf = newAwsVpc name0 (modf (makeAwsVpcParams cidrBlock))
awsVpc' :: NameElement -> CidrBlock -> TF AwsVpc
awsVpc' name0 cidrBlock = newAwsVpc name0 (makeAwsVpcParams cidrBlock)
newAwsVpc :: NameElement -> AwsVpcParams -> TF AwsVpc
newAwsVpc name0 params = do
rid <- mkResource "aws_vpc" name0 (toResourceFieldMap params)
return AwsVpc
{ vpc_id = resourceAttr rid "id"
, vpc_resource = rid
}
data AwsVpc = AwsVpc
{ vpc_id :: TFRef (AwsId AwsVpc)
, vpc_resource :: ResourceId
}
instance IsResource AwsVpc where
resourceId = vpc_resource
data AwsVpcParams = AwsVpcParams
{ _vpc_cidr_block :: CidrBlock
, _vpc_instance_tenancy :: Maybe (T.Text)
, _vpc_enable_dns_support :: Bool
, _vpc_enable_dns_hostnames :: Bool
, _vpc_enable_classic_link :: Bool
, _vpc_tags :: M.Map T.Text T.Text
}
-- vpc_cidr_block :: Lens' AwsVpcParams CidrBlock
vpc_cidr_block :: Functor f => (CidrBlock -> f (CidrBlock)) -> AwsVpcParams -> f AwsVpcParams
vpc_cidr_block k atom = fmap (\newvpc_cidr_block -> atom { _vpc_cidr_block = newvpc_cidr_block }) (k (_vpc_cidr_block atom))
-- vpc_instance_tenancy :: Lens' AwsVpcParams Maybe (T.Text)
vpc_instance_tenancy :: Functor f => (Maybe (T.Text) -> f (Maybe (T.Text))) -> AwsVpcParams -> f AwsVpcParams
vpc_instance_tenancy k atom = fmap (\newvpc_instance_tenancy -> atom { _vpc_instance_tenancy = newvpc_instance_tenancy }) (k (_vpc_instance_tenancy atom))
-- vpc_enable_dns_support :: Lens' AwsVpcParams Bool
vpc_enable_dns_support :: Functor f => (Bool -> f (Bool)) -> AwsVpcParams -> f AwsVpcParams
vpc_enable_dns_support k atom = fmap (\newvpc_enable_dns_support -> atom { _vpc_enable_dns_support = newvpc_enable_dns_support }) (k (_vpc_enable_dns_support atom))
-- vpc_enable_dns_hostnames :: Lens' AwsVpcParams Bool
vpc_enable_dns_hostnames :: Functor f => (Bool -> f (Bool)) -> AwsVpcParams -> f AwsVpcParams
vpc_enable_dns_hostnames k atom = fmap (\newvpc_enable_dns_hostnames -> atom { _vpc_enable_dns_hostnames = newvpc_enable_dns_hostnames }) (k (_vpc_enable_dns_hostnames atom))
-- vpc_enable_classic_link :: Lens' AwsVpcParams Bool
vpc_enable_classic_link :: Functor f => (Bool -> f (Bool)) -> AwsVpcParams -> f AwsVpcParams
vpc_enable_classic_link k atom = fmap (\newvpc_enable_classic_link -> atom { _vpc_enable_classic_link = newvpc_enable_classic_link }) (k (_vpc_enable_classic_link atom))
-- vpc_tags :: Lens' AwsVpcParams M.Map T.Text T.Text
vpc_tags :: Functor f => (M.Map T.Text T.Text -> f (M.Map T.Text T.Text)) -> AwsVpcParams -> f AwsVpcParams
vpc_tags k atom = fmap (\newvpc_tags -> atom { _vpc_tags = newvpc_tags }) (k (_vpc_tags atom))
makeAwsVpcParams :: CidrBlock -> AwsVpcParams
makeAwsVpcParams cidrBlock = AwsVpcParams
{ _vpc_cidr_block = cidrBlock
, _vpc_instance_tenancy = Nothing
, _vpc_enable_dns_support = True
, _vpc_enable_dns_hostnames = False
, _vpc_enable_classic_link = False
, _vpc_tags = M.empty
}
instance ToResourceFieldMap AwsVpcParams where
toResourceFieldMap params
= rfmField "cidr_block" (_vpc_cidr_block params)
<> rfmOptionalField "instance_tenancy" (_vpc_instance_tenancy params)
<> rfmOptionalDefField "enable_dns_support" True (_vpc_enable_dns_support params)
<> rfmOptionalDefField "enable_dns_hostnames" False (_vpc_enable_dns_hostnames params)
<> rfmOptionalDefField "enable_classic_link" False (_vpc_enable_classic_link params)
<> rfmOptionalDefField "tags" M.empty (_vpc_tags params)
instance ToResourceField AwsVpcParams where
toResourceField = RF_Map . toResourceFieldMap
----------------------------------------------------------------------
-- | Add a resource of type AwsNatGateway to the resource graph.
--
-- See the terraform <https://www.terraform.io/docs/providers/aws/r/nat_gateway.html aws_nat_gateway> documentation
-- for details.
-- (In this binding attribute and argument names all have the prefix 'ng_')
awsNatGateway :: NameElement -> TFRef (AwsId AwsEip) -> TFRef (AwsId AwsSubnet) ->(AwsNatGatewayParams -> AwsNatGatewayParams) -> TF AwsNatGateway
awsNatGateway name0 allocationId subnetId modf = newAwsNatGateway name0 (modf (makeAwsNatGatewayParams allocationId subnetId))
awsNatGateway' :: NameElement -> TFRef (AwsId AwsEip) -> TFRef (AwsId AwsSubnet) -> TF AwsNatGateway
awsNatGateway' name0 allocationId subnetId = newAwsNatGateway name0 (makeAwsNatGatewayParams allocationId subnetId)
newAwsNatGateway :: NameElement -> AwsNatGatewayParams -> TF AwsNatGateway
newAwsNatGateway name0 params = do
rid <- mkResource "aws_nat_gateway" name0 (toResourceFieldMap params)
return AwsNatGateway
{ ng_id = resourceAttr rid "id"
, ng_resource = rid
}
data AwsNatGateway = AwsNatGateway
{ ng_id :: TFRef (AwsId AwsNatGateway)
, ng_resource :: ResourceId
}
instance IsResource AwsNatGateway where
resourceId = ng_resource
data AwsNatGatewayParams = AwsNatGatewayParams
{ _ng_allocation_id :: TFRef (AwsId AwsEip)
, _ng_subnet_id :: TFRef (AwsId AwsSubnet)
}
-- ng_allocation_id :: Lens' AwsNatGatewayParams TFRef (AwsId AwsEip)
ng_allocation_id :: Functor f => (TFRef (AwsId AwsEip) -> f (TFRef (AwsId AwsEip))) -> AwsNatGatewayParams -> f AwsNatGatewayParams
ng_allocation_id k atom = fmap (\newng_allocation_id -> atom { _ng_allocation_id = newng_allocation_id }) (k (_ng_allocation_id atom))
-- ng_subnet_id :: Lens' AwsNatGatewayParams TFRef (AwsId AwsSubnet)
ng_subnet_id :: Functor f => (TFRef (AwsId AwsSubnet) -> f (TFRef (AwsId AwsSubnet))) -> AwsNatGatewayParams -> f AwsNatGatewayParams
ng_subnet_id k atom = fmap (\newng_subnet_id -> atom { _ng_subnet_id = newng_subnet_id }) (k (_ng_subnet_id atom))
makeAwsNatGatewayParams :: TFRef (AwsId AwsEip) -> TFRef (AwsId AwsSubnet) -> AwsNatGatewayParams
makeAwsNatGatewayParams allocationId subnetId = AwsNatGatewayParams
{ _ng_allocation_id = allocationId
, _ng_subnet_id = subnetId
}
instance ToResourceFieldMap AwsNatGatewayParams where
toResourceFieldMap params
= rfmField "allocation_id" (_ng_allocation_id params)
<> rfmField "subnet_id" (_ng_subnet_id params)
instance ToResourceField AwsNatGatewayParams where
toResourceField = RF_Map . toResourceFieldMap
----------------------------------------------------------------------
-- | Add a resource of type AwsInternetGateway to the resource graph.
--
-- See the terraform <https://www.terraform.io/docs/providers/aws/r/internet_gateway.html aws_internet_gateway> documentation
-- for details.
-- (In this binding attribute and argument names all have the prefix 'ig_')
awsInternetGateway :: NameElement -> TFRef (AwsId AwsVpc) ->(AwsInternetGatewayParams -> AwsInternetGatewayParams) -> TF AwsInternetGateway
awsInternetGateway name0 vpcId modf = newAwsInternetGateway name0 (modf (makeAwsInternetGatewayParams vpcId))
awsInternetGateway' :: NameElement -> TFRef (AwsId AwsVpc) -> TF AwsInternetGateway
awsInternetGateway' name0 vpcId = newAwsInternetGateway name0 (makeAwsInternetGatewayParams vpcId)
newAwsInternetGateway :: NameElement -> AwsInternetGatewayParams -> TF AwsInternetGateway
newAwsInternetGateway name0 params = do
rid <- mkResource "aws_internet_gateway" name0 (toResourceFieldMap params)
return AwsInternetGateway
{ ig_id = resourceAttr rid "id"
, ig_resource = rid
}
data AwsInternetGateway = AwsInternetGateway
{ ig_id :: TFRef (AwsId AwsInternetGateway)
, ig_resource :: ResourceId
}
instance IsResource AwsInternetGateway where
resourceId = ig_resource
data AwsInternetGatewayParams = AwsInternetGatewayParams
{ _ig_vpc_id :: TFRef (AwsId AwsVpc)
, _ig_tags :: M.Map T.Text T.Text
}
-- ig_vpc_id :: Lens' AwsInternetGatewayParams TFRef (AwsId AwsVpc)
ig_vpc_id :: Functor f => (TFRef (AwsId AwsVpc) -> f (TFRef (AwsId AwsVpc))) -> AwsInternetGatewayParams -> f AwsInternetGatewayParams
ig_vpc_id k atom = fmap (\newig_vpc_id -> atom { _ig_vpc_id = newig_vpc_id }) (k (_ig_vpc_id atom))
-- ig_tags :: Lens' AwsInternetGatewayParams M.Map T.Text T.Text
ig_tags :: Functor f => (M.Map T.Text T.Text -> f (M.Map T.Text T.Text)) -> AwsInternetGatewayParams -> f AwsInternetGatewayParams
ig_tags k atom = fmap (\newig_tags -> atom { _ig_tags = newig_tags }) (k (_ig_tags atom))
makeAwsInternetGatewayParams :: TFRef (AwsId AwsVpc) -> AwsInternetGatewayParams
makeAwsInternetGatewayParams vpcId = AwsInternetGatewayParams
{ _ig_vpc_id = vpcId
, _ig_tags = M.empty
}
instance ToResourceFieldMap AwsInternetGatewayParams where
toResourceFieldMap params
= rfmField "vpc_id" (_ig_vpc_id params)
<> rfmOptionalDefField "tags" M.empty (_ig_tags params)
instance ToResourceField AwsInternetGatewayParams where
toResourceField = RF_Map . toResourceFieldMap
----------------------------------------------------------------------
-- | Add a resource of type AwsSubnet to the resource graph.
--
-- See the terraform <https://www.terraform.io/docs/providers/aws/d/subnet.html aws_subnet> documentation
-- for details.
-- (In this binding attribute and argument names all have the prefix 'sn_')
awsSubnet :: NameElement -> TFRef (AwsId AwsVpc) -> CidrBlock ->(AwsSubnetParams -> AwsSubnetParams) -> TF AwsSubnet
awsSubnet name0 vpcId cidrBlock modf = newAwsSubnet name0 (modf (makeAwsSubnetParams vpcId cidrBlock))
awsSubnet' :: NameElement -> TFRef (AwsId AwsVpc) -> CidrBlock -> TF AwsSubnet
awsSubnet' name0 vpcId cidrBlock = newAwsSubnet name0 (makeAwsSubnetParams vpcId cidrBlock)
newAwsSubnet :: NameElement -> AwsSubnetParams -> TF AwsSubnet
newAwsSubnet name0 params = do
rid <- mkResource "aws_subnet" name0 (toResourceFieldMap params)
return AwsSubnet
{ sn_id = resourceAttr rid "id"
, sn_resource = rid
}
data AwsSubnet = AwsSubnet
{ sn_id :: TFRef (AwsId AwsSubnet)
, sn_resource :: ResourceId
}
instance IsResource AwsSubnet where
resourceId = sn_resource
data AwsSubnetParams = AwsSubnetParams
{ _sn_vpc_id :: TFRef (AwsId AwsVpc)
, _sn_cidr_block :: CidrBlock
, _sn_map_public_ip_on_launch :: Bool
, _sn_availability_zone :: AvailabilityZone
, _sn_tags :: M.Map T.Text T.Text
}
-- sn_vpc_id :: Lens' AwsSubnetParams TFRef (AwsId AwsVpc)
sn_vpc_id :: Functor f => (TFRef (AwsId AwsVpc) -> f (TFRef (AwsId AwsVpc))) -> AwsSubnetParams -> f AwsSubnetParams
sn_vpc_id k atom = fmap (\newsn_vpc_id -> atom { _sn_vpc_id = newsn_vpc_id }) (k (_sn_vpc_id atom))
-- sn_cidr_block :: Lens' AwsSubnetParams CidrBlock
sn_cidr_block :: Functor f => (CidrBlock -> f (CidrBlock)) -> AwsSubnetParams -> f AwsSubnetParams
sn_cidr_block k atom = fmap (\newsn_cidr_block -> atom { _sn_cidr_block = newsn_cidr_block }) (k (_sn_cidr_block atom))
-- sn_map_public_ip_on_launch :: Lens' AwsSubnetParams Bool
sn_map_public_ip_on_launch :: Functor f => (Bool -> f (Bool)) -> AwsSubnetParams -> f AwsSubnetParams
sn_map_public_ip_on_launch k atom = fmap (\newsn_map_public_ip_on_launch -> atom { _sn_map_public_ip_on_launch = newsn_map_public_ip_on_launch }) (k (_sn_map_public_ip_on_launch atom))
-- sn_availability_zone :: Lens' AwsSubnetParams AvailabilityZone
sn_availability_zone :: Functor f => (AvailabilityZone -> f (AvailabilityZone)) -> AwsSubnetParams -> f AwsSubnetParams
sn_availability_zone k atom = fmap (\newsn_availability_zone -> atom { _sn_availability_zone = newsn_availability_zone }) (k (_sn_availability_zone atom))
-- sn_tags :: Lens' AwsSubnetParams M.Map T.Text T.Text
sn_tags :: Functor f => (M.Map T.Text T.Text -> f (M.Map T.Text T.Text)) -> AwsSubnetParams -> f AwsSubnetParams
sn_tags k atom = fmap (\newsn_tags -> atom { _sn_tags = newsn_tags }) (k (_sn_tags atom))
makeAwsSubnetParams :: TFRef (AwsId AwsVpc) -> CidrBlock -> AwsSubnetParams
makeAwsSubnetParams vpcId cidrBlock = AwsSubnetParams
{ _sn_vpc_id = vpcId
, _sn_cidr_block = cidrBlock
, _sn_map_public_ip_on_launch = False
, _sn_availability_zone = ""
, _sn_tags = M.empty
}
instance ToResourceFieldMap AwsSubnetParams where
toResourceFieldMap params
= rfmField "vpc_id" (_sn_vpc_id params)
<> rfmField "cidr_block" (_sn_cidr_block params)
<> rfmOptionalDefField "map_public_ip_on_launch" False (_sn_map_public_ip_on_launch params)
<> rfmOptionalDefField "availability_zone" "" (_sn_availability_zone params)
<> rfmOptionalDefField "tags" M.empty (_sn_tags params)
instance ToResourceField AwsSubnetParams where
toResourceField = RF_Map . toResourceFieldMap
----------------------------------------------------------------------
-- | Add a resource of type AwsRouteTable to the resource graph.
--
-- See the terraform <https://www.terraform.io/docs/providers/aws/r/route_table.html aws_route_table> documentation
-- for details.
-- (In this binding attribute and argument names all have the prefix 'rt_')
awsRouteTable :: NameElement -> TFRef (AwsId AwsVpc) ->(AwsRouteTableParams -> AwsRouteTableParams) -> TF AwsRouteTable
awsRouteTable name0 vpcId modf = newAwsRouteTable name0 (modf (makeAwsRouteTableParams vpcId))
awsRouteTable' :: NameElement -> TFRef (AwsId AwsVpc) -> TF AwsRouteTable
awsRouteTable' name0 vpcId = newAwsRouteTable name0 (makeAwsRouteTableParams vpcId)
newAwsRouteTable :: NameElement -> AwsRouteTableParams -> TF AwsRouteTable
newAwsRouteTable name0 params = do
rid <- mkResource "aws_route_table" name0 (toResourceFieldMap params)
return AwsRouteTable
{ rt_id = resourceAttr rid "id"
, rt_resource = rid
}
data AwsRouteTable = AwsRouteTable
{ rt_id :: TFRef (AwsId AwsRouteTable)
, rt_resource :: ResourceId
}
instance IsResource AwsRouteTable where
resourceId = rt_resource
data AwsRouteTableParams = AwsRouteTableParams
{ _rt_vpc_id :: TFRef (AwsId AwsVpc)
, _rt_tags :: M.Map T.Text T.Text
}
-- rt_vpc_id :: Lens' AwsRouteTableParams TFRef (AwsId AwsVpc)
rt_vpc_id :: Functor f => (TFRef (AwsId AwsVpc) -> f (TFRef (AwsId AwsVpc))) -> AwsRouteTableParams -> f AwsRouteTableParams
rt_vpc_id k atom = fmap (\newrt_vpc_id -> atom { _rt_vpc_id = newrt_vpc_id }) (k (_rt_vpc_id atom))
-- rt_tags :: Lens' AwsRouteTableParams M.Map T.Text T.Text
rt_tags :: Functor f => (M.Map T.Text T.Text -> f (M.Map T.Text T.Text)) -> AwsRouteTableParams -> f AwsRouteTableParams
rt_tags k atom = fmap (\newrt_tags -> atom { _rt_tags = newrt_tags }) (k (_rt_tags atom))
makeAwsRouteTableParams :: TFRef (AwsId AwsVpc) -> AwsRouteTableParams
makeAwsRouteTableParams vpcId = AwsRouteTableParams
{ _rt_vpc_id = vpcId
, _rt_tags = M.empty
}
instance ToResourceFieldMap AwsRouteTableParams where
toResourceFieldMap params
= rfmField "vpc_id" (_rt_vpc_id params)
<> rfmOptionalDefField "tags" M.empty (_rt_tags params)
instance ToResourceField AwsRouteTableParams where
toResourceField = RF_Map . toResourceFieldMap
----------------------------------------------------------------------
-- | Add a resource of type AwsRoute to the resource graph.
--
-- See the terraform <https://www.terraform.io/docs/providers/aws/r/route.html aws_route> documentation
-- for details.
-- (In this binding attribute and argument names all have the prefix 'r_')
awsRoute :: NameElement -> TFRef (AwsId AwsRouteTable) -> CidrBlock ->(AwsRouteParams -> AwsRouteParams) -> TF AwsRoute
awsRoute name0 routeTableId destinationCidrBlock modf = newAwsRoute name0 (modf (makeAwsRouteParams routeTableId destinationCidrBlock))
awsRoute' :: NameElement -> TFRef (AwsId AwsRouteTable) -> CidrBlock -> TF AwsRoute
awsRoute' name0 routeTableId destinationCidrBlock = newAwsRoute name0 (makeAwsRouteParams routeTableId destinationCidrBlock)
newAwsRoute :: NameElement -> AwsRouteParams -> TF AwsRoute
newAwsRoute name0 params = do
rid <- mkResource "aws_route" name0 (toResourceFieldMap params)
return AwsRoute
{ r_resource = rid
}
data AwsRoute = AwsRoute
{ r_resource :: ResourceId
}
instance IsResource AwsRoute where
resourceId = r_resource
data AwsRouteParams = AwsRouteParams
{ _r_route_table_id :: TFRef (AwsId AwsRouteTable)
, _r_destination_cidr_block :: CidrBlock
, _r_nat_gateway_id :: Maybe (TFRef (AwsId AwsNatGateway))
, _r_gateway_id :: Maybe (TFRef (AwsId AwsInternetGateway))
}
-- r_route_table_id :: Lens' AwsRouteParams TFRef (AwsId AwsRouteTable)
r_route_table_id :: Functor f => (TFRef (AwsId AwsRouteTable) -> f (TFRef (AwsId AwsRouteTable))) -> AwsRouteParams -> f AwsRouteParams
r_route_table_id k atom = fmap (\newr_route_table_id -> atom { _r_route_table_id = newr_route_table_id }) (k (_r_route_table_id atom))
-- r_destination_cidr_block :: Lens' AwsRouteParams CidrBlock
r_destination_cidr_block :: Functor f => (CidrBlock -> f (CidrBlock)) -> AwsRouteParams -> f AwsRouteParams
r_destination_cidr_block k atom = fmap (\newr_destination_cidr_block -> atom { _r_destination_cidr_block = newr_destination_cidr_block }) (k (_r_destination_cidr_block atom))
-- r_nat_gateway_id :: Lens' AwsRouteParams Maybe (TFRef (AwsId AwsNatGateway))
r_nat_gateway_id :: Functor f => (Maybe (TFRef (AwsId AwsNatGateway)) -> f (Maybe (TFRef (AwsId AwsNatGateway)))) -> AwsRouteParams -> f AwsRouteParams
r_nat_gateway_id k atom = fmap (\newr_nat_gateway_id -> atom { _r_nat_gateway_id = newr_nat_gateway_id }) (k (_r_nat_gateway_id atom))
-- r_gateway_id :: Lens' AwsRouteParams Maybe (TFRef (AwsId AwsInternetGateway))
r_gateway_id :: Functor f => (Maybe (TFRef (AwsId AwsInternetGateway)) -> f (Maybe (TFRef (AwsId AwsInternetGateway)))) -> AwsRouteParams -> f AwsRouteParams
r_gateway_id k atom = fmap (\newr_gateway_id -> atom { _r_gateway_id = newr_gateway_id }) (k (_r_gateway_id atom))
makeAwsRouteParams :: TFRef (AwsId AwsRouteTable) -> CidrBlock -> AwsRouteParams
makeAwsRouteParams routeTableId destinationCidrBlock = AwsRouteParams
{ _r_route_table_id = routeTableId
, _r_destination_cidr_block = destinationCidrBlock
, _r_nat_gateway_id = Nothing
, _r_gateway_id = Nothing
}
instance ToResourceFieldMap AwsRouteParams where
toResourceFieldMap params
= rfmField "route_table_id" (_r_route_table_id params)
<> rfmField "destination_cidr_block" (_r_destination_cidr_block params)
<> rfmOptionalField "nat_gateway_id" (_r_nat_gateway_id params)
<> rfmOptionalField "gateway_id" (_r_gateway_id params)
instance ToResourceField AwsRouteParams where
toResourceField = RF_Map . toResourceFieldMap
----------------------------------------------------------------------
-- | Add a resource of type AwsRouteTableAssociation to the resource graph.
--
-- See the terraform <https://www.terraform.io/docs/providers/aws/r/route_table_association.html aws_route_table_association> documentation
-- for details.
-- (In this binding attribute and argument names all have the prefix 'rta_')
awsRouteTableAssociation :: NameElement -> TFRef (AwsId AwsSubnet) -> TFRef (AwsId AwsRouteTable) ->(AwsRouteTableAssociationParams -> AwsRouteTableAssociationParams) -> TF AwsRouteTableAssociation
awsRouteTableAssociation name0 subnetId routeTableId modf = newAwsRouteTableAssociation name0 (modf (makeAwsRouteTableAssociationParams subnetId routeTableId))
awsRouteTableAssociation' :: NameElement -> TFRef (AwsId AwsSubnet) -> TFRef (AwsId AwsRouteTable) -> TF AwsRouteTableAssociation
awsRouteTableAssociation' name0 subnetId routeTableId = newAwsRouteTableAssociation name0 (makeAwsRouteTableAssociationParams subnetId routeTableId)
newAwsRouteTableAssociation :: NameElement -> AwsRouteTableAssociationParams -> TF AwsRouteTableAssociation
newAwsRouteTableAssociation name0 params = do
rid <- mkResource "aws_route_table_association" name0 (toResourceFieldMap params)
return AwsRouteTableAssociation
{ rta_id = resourceAttr rid "id"
, rta_resource = rid
}
data AwsRouteTableAssociation = AwsRouteTableAssociation
{ rta_id :: TFRef (AwsId AwsRouteTableAssociation)
, rta_resource :: ResourceId
}
instance IsResource AwsRouteTableAssociation where
resourceId = rta_resource
data AwsRouteTableAssociationParams = AwsRouteTableAssociationParams
{ _rta_subnet_id :: TFRef (AwsId AwsSubnet)
, _rta_route_table_id :: TFRef (AwsId AwsRouteTable)
}
-- rta_subnet_id :: Lens' AwsRouteTableAssociationParams TFRef (AwsId AwsSubnet)
rta_subnet_id :: Functor f => (TFRef (AwsId AwsSubnet) -> f (TFRef (AwsId AwsSubnet))) -> AwsRouteTableAssociationParams -> f AwsRouteTableAssociationParams
rta_subnet_id k atom = fmap (\newrta_subnet_id -> atom { _rta_subnet_id = newrta_subnet_id }) (k (_rta_subnet_id atom))
-- rta_route_table_id :: Lens' AwsRouteTableAssociationParams TFRef (AwsId AwsRouteTable)
rta_route_table_id :: Functor f => (TFRef (AwsId AwsRouteTable) -> f (TFRef (AwsId AwsRouteTable))) -> AwsRouteTableAssociationParams -> f AwsRouteTableAssociationParams
rta_route_table_id k atom = fmap (\newrta_route_table_id -> atom { _rta_route_table_id = newrta_route_table_id }) (k (_rta_route_table_id atom))
makeAwsRouteTableAssociationParams :: TFRef (AwsId AwsSubnet) -> TFRef (AwsId AwsRouteTable) -> AwsRouteTableAssociationParams
makeAwsRouteTableAssociationParams subnetId routeTableId = AwsRouteTableAssociationParams
{ _rta_subnet_id = subnetId
, _rta_route_table_id = routeTableId
}
instance ToResourceFieldMap AwsRouteTableAssociationParams where
toResourceFieldMap params
= rfmField "subnet_id" (_rta_subnet_id params)
<> rfmField "route_table_id" (_rta_route_table_id params)
instance ToResourceField AwsRouteTableAssociationParams where
toResourceField = RF_Map . toResourceFieldMap
----------------------------------------------------------------------
data IngressRuleParams = IngressRuleParams
{ _ir_from_port :: Int
, _ir_to_port :: Int
, _ir_protocol :: T.Text
, _ir_cidr_blocks :: [CidrBlock]
}
deriving (Eq)
-- ir_from_port :: Lens' IngressRuleParams Int
ir_from_port :: Functor f => (Int -> f (Int)) -> IngressRuleParams -> f IngressRuleParams
ir_from_port k atom = fmap (\newir_from_port -> atom { _ir_from_port = newir_from_port }) (k (_ir_from_port atom))
-- ir_to_port :: Lens' IngressRuleParams Int
ir_to_port :: Functor f => (Int -> f (Int)) -> IngressRuleParams -> f IngressRuleParams
ir_to_port k atom = fmap (\newir_to_port -> atom { _ir_to_port = newir_to_port }) (k (_ir_to_port atom))
-- ir_protocol :: Lens' IngressRuleParams T.Text
ir_protocol :: Functor f => (T.Text -> f (T.Text)) -> IngressRuleParams -> f IngressRuleParams
ir_protocol k atom = fmap (\newir_protocol -> atom { _ir_protocol = newir_protocol }) (k (_ir_protocol atom))
-- ir_cidr_blocks :: Lens' IngressRuleParams [CidrBlock]
ir_cidr_blocks :: Functor f => ([CidrBlock] -> f ([CidrBlock])) -> IngressRuleParams -> f IngressRuleParams
ir_cidr_blocks k atom = fmap (\newir_cidr_blocks -> atom { _ir_cidr_blocks = newir_cidr_blocks }) (k (_ir_cidr_blocks atom))
makeIngressRuleParams :: Int -> Int -> T.Text -> IngressRuleParams
makeIngressRuleParams fromPort toPort protocol = IngressRuleParams
{ _ir_from_port = fromPort
, _ir_to_port = toPort
, _ir_protocol = protocol
, _ir_cidr_blocks = []
}
instance ToResourceFieldMap IngressRuleParams where
toResourceFieldMap params
= rfmField "from_port" (_ir_from_port params)
<> rfmField "to_port" (_ir_to_port params)
<> rfmField "protocol" (_ir_protocol params)
<> rfmOptionalDefField "cidr_blocks" [] (_ir_cidr_blocks params)
instance ToResourceField IngressRuleParams where
toResourceField = RF_Map . toResourceFieldMap
----------------------------------------------------------------------
data EgressRuleParams = EgressRuleParams
{ _er_from_port :: Int
, _er_to_port :: Int
, _er_protocol :: T.Text
, _er_cidr_blocks :: [CidrBlock]
}
deriving (Eq)
-- er_from_port :: Lens' EgressRuleParams Int
er_from_port :: Functor f => (Int -> f (Int)) -> EgressRuleParams -> f EgressRuleParams
er_from_port k atom = fmap (\newer_from_port -> atom { _er_from_port = newer_from_port }) (k (_er_from_port atom))
-- er_to_port :: Lens' EgressRuleParams Int
er_to_port :: Functor f => (Int -> f (Int)) -> EgressRuleParams -> f EgressRuleParams
er_to_port k atom = fmap (\newer_to_port -> atom { _er_to_port = newer_to_port }) (k (_er_to_port atom))
-- er_protocol :: Lens' EgressRuleParams T.Text
er_protocol :: Functor f => (T.Text -> f (T.Text)) -> EgressRuleParams -> f EgressRuleParams
er_protocol k atom = fmap (\newer_protocol -> atom { _er_protocol = newer_protocol }) (k (_er_protocol atom))
-- er_cidr_blocks :: Lens' EgressRuleParams [CidrBlock]
er_cidr_blocks :: Functor f => ([CidrBlock] -> f ([CidrBlock])) -> EgressRuleParams -> f EgressRuleParams
er_cidr_blocks k atom = fmap (\newer_cidr_blocks -> atom { _er_cidr_blocks = newer_cidr_blocks }) (k (_er_cidr_blocks atom))
makeEgressRuleParams :: Int -> Int -> T.Text -> EgressRuleParams
makeEgressRuleParams fromPort toPort protocol = EgressRuleParams
{ _er_from_port = fromPort
, _er_to_port = toPort
, _er_protocol = protocol
, _er_cidr_blocks = []
}
instance ToResourceFieldMap EgressRuleParams where
toResourceFieldMap params
= rfmField "from_port" (_er_from_port params)
<> rfmField "to_port" (_er_to_port params)
<> rfmField "protocol" (_er_protocol params)
<> rfmOptionalDefField "cidr_blocks" [] (_er_cidr_blocks params)
instance ToResourceField EgressRuleParams where
toResourceField = RF_Map . toResourceFieldMap
----------------------------------------------------------------------
-- | Add a resource of type AwsSecurityGroup to the resource graph.
--
-- See the terraform <https://www.terraform.io/docs/providers/aws/r/security_group.html aws_security_group> documentation
-- for details.
-- (In this binding attribute and argument names all have the prefix 'sg_')
awsSecurityGroup :: NameElement -> (AwsSecurityGroupParams -> AwsSecurityGroupParams) -> TF AwsSecurityGroup
awsSecurityGroup name0 modf = newAwsSecurityGroup name0 (modf (makeAwsSecurityGroupParams ))
awsSecurityGroup' :: NameElement -> TF AwsSecurityGroup
awsSecurityGroup' name0 = newAwsSecurityGroup name0 (makeAwsSecurityGroupParams )
newAwsSecurityGroup :: NameElement -> AwsSecurityGroupParams -> TF AwsSecurityGroup
newAwsSecurityGroup name0 params = do
rid <- mkResource "aws_security_group" name0 (toResourceFieldMap params)
return AwsSecurityGroup
{ sg_id = resourceAttr rid "id"
, sg_owner_id = resourceAttr rid "owner_id"
, sg_resource = rid
}
data AwsSecurityGroup = AwsSecurityGroup
{ sg_id :: TFRef (AwsId AwsSecurityGroup)
, sg_owner_id :: TFRef T.Text
, sg_resource :: ResourceId
}
instance IsResource AwsSecurityGroup where
resourceId = sg_resource
data AwsSecurityGroupParams = AwsSecurityGroupParams
{ _sg_name :: T.Text
, _sg_name_prefix :: T.Text
, _sg_description :: T.Text
, _sg_ingress :: [IngressRuleParams]
, _sg_egress :: [EgressRuleParams]
, _sg_vpc_id :: Maybe (TFRef (AwsId AwsVpc))
, _sg_tags :: M.Map T.Text T.Text
}
-- sg_name :: Lens' AwsSecurityGroupParams T.Text
sg_name :: Functor f => (T.Text -> f (T.Text)) -> AwsSecurityGroupParams -> f AwsSecurityGroupParams
sg_name k atom = fmap (\newsg_name -> atom { _sg_name = newsg_name }) (k (_sg_name atom))
-- sg_name_prefix :: Lens' AwsSecurityGroupParams T.Text
sg_name_prefix :: Functor f => (T.Text -> f (T.Text)) -> AwsSecurityGroupParams -> f AwsSecurityGroupParams
sg_name_prefix k atom = fmap (\newsg_name_prefix -> atom { _sg_name_prefix = newsg_name_prefix }) (k (_sg_name_prefix atom))
-- sg_description :: Lens' AwsSecurityGroupParams T.Text
sg_description :: Functor f => (T.Text -> f (T.Text)) -> AwsSecurityGroupParams -> f AwsSecurityGroupParams
sg_description k atom = fmap (\newsg_description -> atom { _sg_description = newsg_description }) (k (_sg_description atom))
-- sg_ingress :: Lens' AwsSecurityGroupParams [IngressRuleParams]
sg_ingress :: Functor f => ([IngressRuleParams] -> f ([IngressRuleParams])) -> AwsSecurityGroupParams -> f AwsSecurityGroupParams
sg_ingress k atom = fmap (\newsg_ingress -> atom { _sg_ingress = newsg_ingress }) (k (_sg_ingress atom))
-- sg_egress :: Lens' AwsSecurityGroupParams [EgressRuleParams]
sg_egress :: Functor f => ([EgressRuleParams] -> f ([EgressRuleParams])) -> AwsSecurityGroupParams -> f AwsSecurityGroupParams
sg_egress k atom = fmap (\newsg_egress -> atom { _sg_egress = newsg_egress }) (k (_sg_egress atom))
-- sg_vpc_id :: Lens' AwsSecurityGroupParams Maybe (TFRef (AwsId AwsVpc))
sg_vpc_id :: Functor f => (Maybe (TFRef (AwsId AwsVpc)) -> f (Maybe (TFRef (AwsId AwsVpc)))) -> AwsSecurityGroupParams -> f AwsSecurityGroupParams
sg_vpc_id k atom = fmap (\newsg_vpc_id -> atom { _sg_vpc_id = newsg_vpc_id }) (k (_sg_vpc_id atom))
-- sg_tags :: Lens' AwsSecurityGroupParams M.Map T.Text T.Text
sg_tags :: Functor f => (M.Map T.Text T.Text -> f (M.Map T.Text T.Text)) -> AwsSecurityGroupParams -> f AwsSecurityGroupParams
sg_tags k atom = fmap (\newsg_tags -> atom { _sg_tags = newsg_tags }) (k (_sg_tags atom))
makeAwsSecurityGroupParams :: AwsSecurityGroupParams
makeAwsSecurityGroupParams = AwsSecurityGroupParams
{ _sg_name = ""
, _sg_name_prefix = ""
, _sg_description = ""
, _sg_ingress = []
, _sg_egress = []
, _sg_vpc_id = Nothing
, _sg_tags = M.empty
}
instance ToResourceFieldMap AwsSecurityGroupParams where
toResourceFieldMap params
= rfmOptionalDefField "name" "" (_sg_name params)
<> rfmOptionalDefField "name_prefix" "" (_sg_name_prefix params)
<> rfmOptionalDefField "description" "" (_sg_description params)
<> rfmOptionalDefField "ingress" [] (_sg_ingress params)
<> rfmOptionalDefField "egress" [] (_sg_egress params)
<> rfmOptionalField "vpc_id" (_sg_vpc_id params)
<> rfmOptionalDefField "tags" M.empty (_sg_tags params)
instance ToResourceField AwsSecurityGroupParams where
toResourceField = RF_Map . toResourceFieldMap
----------------------------------------------------------------------
data RootBlockDeviceParams = RootBlockDeviceParams
{ _rbd_volume_type :: VolumeType
, _rbd_volume_size :: Maybe (Int)
, _rbd_delete_on_termination :: Bool
}
deriving (Eq)
-- rbd_volume_type :: Lens' RootBlockDeviceParams VolumeType
rbd_volume_type :: Functor f => (VolumeType -> f (VolumeType)) -> RootBlockDeviceParams -> f RootBlockDeviceParams
rbd_volume_type k atom = fmap (\newrbd_volume_type -> atom { _rbd_volume_type = newrbd_volume_type }) (k (_rbd_volume_type atom))
-- rbd_volume_size :: Lens' RootBlockDeviceParams Maybe (Int)
rbd_volume_size :: Functor f => (Maybe (Int) -> f (Maybe (Int))) -> RootBlockDeviceParams -> f RootBlockDeviceParams
rbd_volume_size k atom = fmap (\newrbd_volume_size -> atom { _rbd_volume_size = newrbd_volume_size }) (k (_rbd_volume_size atom))
-- rbd_delete_on_termination :: Lens' RootBlockDeviceParams Bool
rbd_delete_on_termination :: Functor f => (Bool -> f (Bool)) -> RootBlockDeviceParams -> f RootBlockDeviceParams
rbd_delete_on_termination k atom = fmap (\newrbd_delete_on_termination -> atom { _rbd_delete_on_termination = newrbd_delete_on_termination }) (k (_rbd_delete_on_termination atom))
makeRootBlockDeviceParams :: RootBlockDeviceParams
makeRootBlockDeviceParams = RootBlockDeviceParams
{ _rbd_volume_type = "standard"
, _rbd_volume_size = Nothing
, _rbd_delete_on_termination = True
}
instance ToResourceFieldMap RootBlockDeviceParams where
toResourceFieldMap params
= rfmOptionalDefField "volume_type" "standard" (_rbd_volume_type params)
<> rfmOptionalField "volume_size" (_rbd_volume_size params)
<> rfmOptionalDefField "delete_on_termination" True (_rbd_delete_on_termination params)
instance ToResourceField RootBlockDeviceParams where
toResourceField = RF_Map . toResourceFieldMap
----------------------------------------------------------------------
-- | Add a resource of type AwsInstance to the resource graph.
--
-- See the terraform <https://www.terraform.io/docs/providers/aws/r/instance.html aws_instance> documentation
-- for details.
-- (In this binding attribute and argument names all have the prefix 'i_')
awsInstance :: NameElement -> Ami -> InstanceType ->(AwsInstanceParams -> AwsInstanceParams) -> TF AwsInstance
awsInstance name0 ami instanceType modf = newAwsInstance name0 (modf (makeAwsInstanceParams ami instanceType))
awsInstance' :: NameElement -> Ami -> InstanceType -> TF AwsInstance
awsInstance' name0 ami instanceType = newAwsInstance name0 (makeAwsInstanceParams ami instanceType)
newAwsInstance :: NameElement -> AwsInstanceParams -> TF AwsInstance
newAwsInstance name0 params = do
rid <- mkResource "aws_instance" name0 (toResourceFieldMap params)
return AwsInstance
{ i_id = resourceAttr rid "id"
, i_public_ip = resourceAttr rid "public_ip"
, i_private_ip = resourceAttr rid "private_ip"
, i_resource = rid
}
data AwsInstance = AwsInstance
{ i_id :: TFRef (AwsId AwsInstance)
, i_public_ip :: TFRef IpAddress
, i_private_ip :: TFRef IpAddress
, i_resource :: ResourceId
}
instance IsResource AwsInstance where
resourceId = i_resource
data AwsInstanceParams = AwsInstanceParams
{ _i_ami :: Ami
, _i_instance_type :: InstanceType
, _i_availability_zone :: AvailabilityZone
, _i_ebs_optimized :: Maybe (Bool)
, _i_key_name :: Maybe (KeyName)
, _i_monitoring :: Bool
, _i_subnet_id :: Maybe (TFRef (AwsId AwsSubnet))
, _i_associate_public_ip_address :: Maybe (Bool)
, _i_root_block_device :: Maybe (RootBlockDeviceParams)
, _i_user_data :: T.Text
, _i_iam_instance_profile :: Maybe (TFRef (AwsId AwsIamInstanceProfile))
, _i_vpc_security_group_ids :: [TFRef (AwsId AwsSecurityGroup)]
, _i_tags :: M.Map T.Text T.Text
}
-- i_ami :: Lens' AwsInstanceParams Ami
i_ami :: Functor f => (Ami -> f (Ami)) -> AwsInstanceParams -> f AwsInstanceParams
i_ami k atom = fmap (\newi_ami -> atom { _i_ami = newi_ami }) (k (_i_ami atom))
-- i_availability_zone :: Lens' AwsInstanceParams AvailabilityZone
i_availability_zone :: Functor f => (AvailabilityZone -> f (AvailabilityZone)) -> AwsInstanceParams -> f AwsInstanceParams
i_availability_zone k atom = fmap (\newi_availability_zone -> atom { _i_availability_zone = newi_availability_zone }) (k (_i_availability_zone atom))
-- i_ebs_optimized :: Lens' AwsInstanceParams Maybe (Bool)
i_ebs_optimized :: Functor f => (Maybe (Bool) -> f (Maybe (Bool))) -> AwsInstanceParams -> f AwsInstanceParams
i_ebs_optimized k atom = fmap (\newi_ebs_optimized -> atom { _i_ebs_optimized = newi_ebs_optimized }) (k (_i_ebs_optimized atom))
-- i_instance_type :: Lens' AwsInstanceParams InstanceType
i_instance_type :: Functor f => (InstanceType -> f (InstanceType)) -> AwsInstanceParams -> f AwsInstanceParams
i_instance_type k atom = fmap (\newi_instance_type -> atom { _i_instance_type = newi_instance_type }) (k (_i_instance_type atom))
-- i_key_name :: Lens' AwsInstanceParams Maybe (KeyName)
i_key_name :: Functor f => (Maybe (KeyName) -> f (Maybe (KeyName))) -> AwsInstanceParams -> f AwsInstanceParams
i_key_name k atom = fmap (\newi_key_name -> atom { _i_key_name = newi_key_name }) (k (_i_key_name atom))
-- i_monitoring :: Lens' AwsInstanceParams Bool
i_monitoring :: Functor f => (Bool -> f (Bool)) -> AwsInstanceParams -> f AwsInstanceParams
i_monitoring k atom = fmap (\newi_monitoring -> atom { _i_monitoring = newi_monitoring }) (k (_i_monitoring atom))
-- i_subnet_id :: Lens' AwsInstanceParams Maybe (TFRef (AwsId AwsSubnet))
i_subnet_id :: Functor f => (Maybe (TFRef (AwsId AwsSubnet)) -> f (Maybe (TFRef (AwsId AwsSubnet)))) -> AwsInstanceParams -> f AwsInstanceParams
i_subnet_id k atom = fmap (\newi_subnet_id -> atom { _i_subnet_id = newi_subnet_id }) (k (_i_subnet_id atom))
-- i_associate_public_ip_address :: Lens' AwsInstanceParams Maybe (Bool)
i_associate_public_ip_address :: Functor f => (Maybe (Bool) -> f (Maybe (Bool))) -> AwsInstanceParams -> f AwsInstanceParams
i_associate_public_ip_address k atom = fmap (\newi_associate_public_ip_address -> atom { _i_associate_public_ip_address = newi_associate_public_ip_address }) (k (_i_associate_public_ip_address atom))
-- i_root_block_device :: Lens' AwsInstanceParams Maybe (RootBlockDeviceParams)
i_root_block_device :: Functor f => (Maybe (RootBlockDeviceParams) -> f (Maybe (RootBlockDeviceParams))) -> AwsInstanceParams -> f AwsInstanceParams
i_root_block_device k atom = fmap (\newi_root_block_device -> atom { _i_root_block_device = newi_root_block_device }) (k (_i_root_block_device atom))
-- i_user_data :: Lens' AwsInstanceParams T.Text
i_user_data :: Functor f => (T.Text -> f (T.Text)) -> AwsInstanceParams -> f AwsInstanceParams
i_user_data k atom = fmap (\newi_user_data -> atom { _i_user_data = newi_user_data }) (k (_i_user_data atom))
-- i_iam_instance_profile :: Lens' AwsInstanceParams Maybe (TFRef (AwsId AwsIamInstanceProfile))
i_iam_instance_profile :: Functor f => (Maybe (TFRef (AwsId AwsIamInstanceProfile)) -> f (Maybe (TFRef (AwsId AwsIamInstanceProfile)))) -> AwsInstanceParams -> f AwsInstanceParams
i_iam_instance_profile k atom = fmap (\newi_iam_instance_profile -> atom { _i_iam_instance_profile = newi_iam_instance_profile }) (k (_i_iam_instance_profile atom))
-- i_vpc_security_group_ids :: Lens' AwsInstanceParams [TFRef (AwsId AwsSecurityGroup)]
i_vpc_security_group_ids :: Functor f => ([TFRef (AwsId AwsSecurityGroup)] -> f ([TFRef (AwsId AwsSecurityGroup)])) -> AwsInstanceParams -> f AwsInstanceParams
i_vpc_security_group_ids k atom = fmap (\newi_vpc_security_group_ids -> atom { _i_vpc_security_group_ids = newi_vpc_security_group_ids }) (k (_i_vpc_security_group_ids atom))
-- i_tags :: Lens' AwsInstanceParams M.Map T.Text T.Text
i_tags :: Functor f => (M.Map T.Text T.Text -> f (M.Map T.Text T.Text)) -> AwsInstanceParams -> f AwsInstanceParams
i_tags k atom = fmap (\newi_tags -> atom { _i_tags = newi_tags }) (k (_i_tags atom))
makeAwsInstanceParams :: Ami -> InstanceType -> AwsInstanceParams
makeAwsInstanceParams ami instanceType = AwsInstanceParams
{ _i_ami = ami
, _i_instance_type = instanceType
, _i_availability_zone = ""
, _i_ebs_optimized = Nothing
, _i_key_name = Nothing
, _i_monitoring = True
, _i_subnet_id = Nothing
, _i_associate_public_ip_address = Nothing
, _i_root_block_device = Nothing
, _i_user_data = ""
, _i_iam_instance_profile = Nothing
, _i_vpc_security_group_ids = []
, _i_tags = M.empty
}
instance ToResourceFieldMap AwsInstanceParams where
toResourceFieldMap params
= rfmField "ami" (_i_ami params)
<> rfmOptionalDefField "availability_zone" "" (_i_availability_zone params)
<> rfmOptionalField "ebs_optimized" (_i_ebs_optimized params)
<> rfmField "instance_type" (_i_instance_type params)
<> rfmOptionalField "key_name" (_i_key_name params)
<> rfmOptionalDefField "monitoring" True (_i_monitoring params)
<> rfmOptionalField "subnet_id" (_i_subnet_id params)
<> rfmOptionalField "associate_public_ip_address" (_i_associate_public_ip_address params)
<> rfmOptionalField "root_block_device" (_i_root_block_device params)
<> rfmOptionalDefField "user_data" "" (_i_user_data params)
<> rfmOptionalField "iam_instance_profile" (_i_iam_instance_profile params)
<> rfmOptionalDefField "vpc_security_group_ids" [] (_i_vpc_security_group_ids params)
<> rfmOptionalDefField "tags" M.empty (_i_tags params)
instance ToResourceField AwsInstanceParams where
toResourceField = RF_Map . toResourceFieldMap
----------------------------------------------------------------------
-- | Add a resource of type AwsLaunchConfiguration to the resource graph.
--
-- See the terraform <https://www.terraform.io/docs/providers/aws/r/launch_configuration.html aws_launch_configuration> documentation
-- for details.
-- (In this binding attribute and argument names all have the prefix 'lc_')
awsLaunchConfiguration :: NameElement -> Ami -> InstanceType ->(AwsLaunchConfigurationParams -> AwsLaunchConfigurationParams) -> TF AwsLaunchConfiguration
awsLaunchConfiguration name0 imageId instanceType modf = newAwsLaunchConfiguration name0 (modf (makeAwsLaunchConfigurationParams imageId instanceType))
awsLaunchConfiguration' :: NameElement -> Ami -> InstanceType -> TF AwsLaunchConfiguration
awsLaunchConfiguration' name0 imageId instanceType = newAwsLaunchConfiguration name0 (makeAwsLaunchConfigurationParams imageId instanceType)
newAwsLaunchConfiguration :: NameElement -> AwsLaunchConfigurationParams -> TF AwsLaunchConfiguration
newAwsLaunchConfiguration name0 params = do
rid <- mkResource "aws_launch_configuration" name0 (toResourceFieldMap params)
return AwsLaunchConfiguration
{ lc_id = resourceAttr rid "id"
, lc_name = resourceAttr rid "name"
, lc_resource = rid
}
data AwsLaunchConfiguration = AwsLaunchConfiguration
{ lc_id :: TFRef (AwsId AwsLaunchConfiguration)
, lc_name :: TFRef T.Text
, lc_resource :: ResourceId
}
instance IsResource AwsLaunchConfiguration where
resourceId = lc_resource
data AwsLaunchConfigurationParams = AwsLaunchConfigurationParams
{ _lc_image_id :: Ami
, _lc_instance_type :: InstanceType
, _lc_name' :: T.Text
, _lc_name_prefix :: T.Text
, _lc_iam_instance_profile :: Maybe (TFRef (AwsId AwsIamInstanceProfile))
, _lc_key_name :: Maybe (KeyName)
, _lc_security_groups :: [TFRef (AwsId AwsSecurityGroup)]
, _lc_associate_public_ip_address :: Maybe (Bool)
, _lc_user_data :: T.Text
, _lc_enable_monitoring :: Bool
, _lc_ebs_optimized :: Maybe (Bool)
, _lc_root_block_device :: Maybe (RootBlockDeviceParams)
}
-- lc_name' :: Lens' AwsLaunchConfigurationParams T.Text
lc_name' :: Functor f => (T.Text -> f (T.Text)) -> AwsLaunchConfigurationParams -> f AwsLaunchConfigurationParams
lc_name' k atom = fmap (\newlc_name' -> atom { _lc_name' = newlc_name' }) (k (_lc_name' atom))
-- lc_name_prefix :: Lens' AwsLaunchConfigurationParams T.Text
lc_name_prefix :: Functor f => (T.Text -> f (T.Text)) -> AwsLaunchConfigurationParams -> f AwsLaunchConfigurationParams
lc_name_prefix k atom = fmap (\newlc_name_prefix -> atom { _lc_name_prefix = newlc_name_prefix }) (k (_lc_name_prefix atom))
-- lc_image_id :: Lens' AwsLaunchConfigurationParams Ami
lc_image_id :: Functor f => (Ami -> f (Ami)) -> AwsLaunchConfigurationParams -> f AwsLaunchConfigurationParams
lc_image_id k atom = fmap (\newlc_image_id -> atom { _lc_image_id = newlc_image_id }) (k (_lc_image_id atom))
-- lc_instance_type :: Lens' AwsLaunchConfigurationParams InstanceType
lc_instance_type :: Functor f => (InstanceType -> f (InstanceType)) -> AwsLaunchConfigurationParams -> f AwsLaunchConfigurationParams
lc_instance_type k atom = fmap (\newlc_instance_type -> atom { _lc_instance_type = newlc_instance_type }) (k (_lc_instance_type atom))
-- lc_iam_instance_profile :: Lens' AwsLaunchConfigurationParams Maybe (TFRef (AwsId AwsIamInstanceProfile))
lc_iam_instance_profile :: Functor f => (Maybe (TFRef (AwsId AwsIamInstanceProfile)) -> f (Maybe (TFRef (AwsId AwsIamInstanceProfile)))) -> AwsLaunchConfigurationParams -> f AwsLaunchConfigurationParams
lc_iam_instance_profile k atom = fmap (\newlc_iam_instance_profile -> atom { _lc_iam_instance_profile = newlc_iam_instance_profile }) (k (_lc_iam_instance_profile atom))
-- lc_key_name :: Lens' AwsLaunchConfigurationParams Maybe (KeyName)
lc_key_name :: Functor f => (Maybe (KeyName) -> f (Maybe (KeyName))) -> AwsLaunchConfigurationParams -> f AwsLaunchConfigurationParams
lc_key_name k atom = fmap (\newlc_key_name -> atom { _lc_key_name = newlc_key_name }) (k (_lc_key_name atom))
-- lc_security_groups :: Lens' AwsLaunchConfigurationParams [TFRef (AwsId AwsSecurityGroup)]
lc_security_groups :: Functor f => ([TFRef (AwsId AwsSecurityGroup)] -> f ([TFRef (AwsId AwsSecurityGroup)])) -> AwsLaunchConfigurationParams -> f AwsLaunchConfigurationParams
lc_security_groups k atom = fmap (\newlc_security_groups -> atom { _lc_security_groups = newlc_security_groups }) (k (_lc_security_groups atom))
-- lc_associate_public_ip_address :: Lens' AwsLaunchConfigurationParams Maybe (Bool)
lc_associate_public_ip_address :: Functor f => (Maybe (Bool) -> f (Maybe (Bool))) -> AwsLaunchConfigurationParams -> f AwsLaunchConfigurationParams
lc_associate_public_ip_address k atom = fmap (\newlc_associate_public_ip_address -> atom { _lc_associate_public_ip_address = newlc_associate_public_ip_address }) (k (_lc_associate_public_ip_address atom))
-- lc_user_data :: Lens' AwsLaunchConfigurationParams T.Text
lc_user_data :: Functor f => (T.Text -> f (T.Text)) -> AwsLaunchConfigurationParams -> f AwsLaunchConfigurationParams
lc_user_data k atom = fmap (\newlc_user_data -> atom { _lc_user_data = newlc_user_data }) (k (_lc_user_data atom))
-- lc_enable_monitoring :: Lens' AwsLaunchConfigurationParams Bool
lc_enable_monitoring :: Functor f => (Bool -> f (Bool)) -> AwsLaunchConfigurationParams -> f AwsLaunchConfigurationParams
lc_enable_monitoring k atom = fmap (\newlc_enable_monitoring -> atom { _lc_enable_monitoring = newlc_enable_monitoring }) (k (_lc_enable_monitoring atom))
-- lc_ebs_optimized :: Lens' AwsLaunchConfigurationParams Maybe (Bool)
lc_ebs_optimized :: Functor f => (Maybe (Bool) -> f (Maybe (Bool))) -> AwsLaunchConfigurationParams -> f AwsLaunchConfigurationParams
lc_ebs_optimized k atom = fmap (\newlc_ebs_optimized -> atom { _lc_ebs_optimized = newlc_ebs_optimized }) (k (_lc_ebs_optimized atom))
-- lc_root_block_device :: Lens' AwsLaunchConfigurationParams Maybe (RootBlockDeviceParams)
lc_root_block_device :: Functor f => (Maybe (RootBlockDeviceParams) -> f (Maybe (RootBlockDeviceParams))) -> AwsLaunchConfigurationParams -> f AwsLaunchConfigurationParams
lc_root_block_device k atom = fmap (\newlc_root_block_device -> atom { _lc_root_block_device = newlc_root_block_device }) (k (_lc_root_block_device atom))
makeAwsLaunchConfigurationParams :: Ami -> InstanceType -> AwsLaunchConfigurationParams
makeAwsLaunchConfigurationParams imageId instanceType = AwsLaunchConfigurationParams
{ _lc_image_id = imageId
, _lc_instance_type = instanceType
, _lc_name' = ""
, _lc_name_prefix = ""
, _lc_iam_instance_profile = Nothing
, _lc_key_name = Nothing
, _lc_security_groups = []
, _lc_associate_public_ip_address = Nothing
, _lc_user_data = ""
, _lc_enable_monitoring = True
, _lc_ebs_optimized = Nothing
, _lc_root_block_device = Nothing
}
instance ToResourceFieldMap AwsLaunchConfigurationParams where
toResourceFieldMap params
= rfmOptionalDefField "name" "" (_lc_name' params)
<> rfmOptionalDefField "name_prefix" "" (_lc_name_prefix params)
<> rfmField "image_id" (_lc_image_id params)
<> rfmField "instance_type" (_lc_instance_type params)
<> rfmOptionalField "iam_instance_profile" (_lc_iam_instance_profile params)
<> rfmOptionalField "key_name" (_lc_key_name params)
<> rfmOptionalDefField "security_groups" [] (_lc_security_groups params)
<> rfmOptionalField "associate_public_ip_address" (_lc_associate_public_ip_address params)
<> rfmOptionalDefField "user_data" "" (_lc_user_data params)
<> rfmOptionalDefField "enable_monitoring" True (_lc_enable_monitoring params)
<> rfmOptionalField "ebs_optimized" (_lc_ebs_optimized params)
<> rfmOptionalField "root_block_device" (_lc_root_block_device params)
instance ToResourceField AwsLaunchConfigurationParams where
toResourceField = RF_Map . toResourceFieldMap
----------------------------------------------------------------------
-- | Add a resource of type AwsAutoscalingGroup to the resource graph.
--
-- See the terraform <https://www.terraform.io/docs/providers/aws/r/autoscaling_group.html aws_autoscaling_group> documentation
-- for details.
-- (In this binding attribute and argument names all have the prefix 'ag_')
awsAutoscalingGroup :: NameElement -> Int -> Int -> TFRef T.Text ->(AwsAutoscalingGroupParams -> AwsAutoscalingGroupParams) -> TF AwsAutoscalingGroup
awsAutoscalingGroup name0 maxSize minSize launchConfiguration modf = newAwsAutoscalingGroup name0 (modf (makeAwsAutoscalingGroupParams maxSize minSize launchConfiguration))
awsAutoscalingGroup' :: NameElement -> Int -> Int -> TFRef T.Text -> TF AwsAutoscalingGroup
awsAutoscalingGroup' name0 maxSize minSize launchConfiguration = newAwsAutoscalingGroup name0 (makeAwsAutoscalingGroupParams maxSize minSize launchConfiguration)
newAwsAutoscalingGroup :: NameElement -> AwsAutoscalingGroupParams -> TF AwsAutoscalingGroup
newAwsAutoscalingGroup name0 params = do
rid <- mkResource "aws_autoscaling_group" name0 (toResourceFieldMap params)
return AwsAutoscalingGroup
{ ag_id = resourceAttr rid "id"
, ag_arn = resourceAttr rid "arn"
, ag_name = resourceAttr rid "name"
, ag_resource = rid
}
data AwsAutoscalingGroup = AwsAutoscalingGroup
{ ag_id :: TFRef (AwsId AwsAutoscalingGroup)
, ag_arn :: TFRef Arn
, ag_name :: TFRef T.Text
, ag_resource :: ResourceId