Skip to content

Commit 23172e5

Browse files
Software and workloads configs (#9653) (#16887)
* add dag processor resources * add web_server_plugins_mode * add docs * add tests, replace go client, guard nil PrivateClusterConfig * new api version * add mapping for web server plugins mode * add create test * make beta only * valid cpu in dag_processor test * add 'Computed' to individual workload resources, align. * make workload resources computed * remove computed from required fields [upstream:09a193c942d2b3c1b1fe0a2c857ba1010a149c5c] Signed-off-by: Modular Magician <[email protected]>
1 parent 910c662 commit 23172e5

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

.changelog/9653.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
google_composer_environment: added support for creation and update for config.software_config.web_server_plugins_mode and config.workloads_config. dag_processor fields.
3+
```

google/services/composer/resource_composer_environment.go

+16
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,7 @@ func ResourceComposerEnvironment() *schema.Resource {
637637
Optional: true,
638638
AtLeastOneOf: workloadsConfigKeys,
639639
ForceNew: false,
640+
Computed: true,
640641
Description: `Configuration for resources used by Airflow schedulers.`,
641642
MaxItems: 1,
642643
Elem: &schema.Resource{
@@ -645,27 +646,31 @@ func ResourceComposerEnvironment() *schema.Resource {
645646
Type: schema.TypeFloat,
646647
Optional: true,
647648
ForceNew: false,
649+
Computed: true,
648650
ValidateFunc: validation.FloatAtLeast(0),
649651
Description: `CPU request and limit for a single Airflow scheduler replica`,
650652
},
651653
"memory_gb": {
652654
Type: schema.TypeFloat,
653655
Optional: true,
654656
ForceNew: false,
657+
Computed: true,
655658
ValidateFunc: validation.FloatAtLeast(0),
656659
Description: `Memory (GB) request and limit for a single Airflow scheduler replica.`,
657660
},
658661
"storage_gb": {
659662
Type: schema.TypeFloat,
660663
Optional: true,
661664
ForceNew: false,
665+
Computed: true,
662666
ValidateFunc: validation.FloatAtLeast(0),
663667
Description: `Storage (GB) request and limit for a single Airflow scheduler replica.`,
664668
},
665669
"count": {
666670
Type: schema.TypeInt,
667671
Optional: true,
668672
ForceNew: false,
673+
Computed: true,
669674
ValidateFunc: validation.IntAtLeast(0),
670675
Description: `The number of schedulers.`,
671676
},
@@ -676,6 +681,7 @@ func ResourceComposerEnvironment() *schema.Resource {
676681
Type: schema.TypeList,
677682
Optional: true,
678683
AtLeastOneOf: workloadsConfigKeys,
684+
Computed: true,
679685
Description: `Configuration for resources used by Airflow triggerers.`,
680686
MaxItems: 1,
681687
Elem: &schema.Resource{
@@ -706,6 +712,7 @@ func ResourceComposerEnvironment() *schema.Resource {
706712
Optional: true,
707713
AtLeastOneOf: workloadsConfigKeys,
708714
ForceNew: false,
715+
Computed: true,
709716
Description: `Configuration for resources used by Airflow web server.`,
710717
MaxItems: 1,
711718
Elem: &schema.Resource{
@@ -714,20 +721,23 @@ func ResourceComposerEnvironment() *schema.Resource {
714721
Type: schema.TypeFloat,
715722
Optional: true,
716723
ForceNew: false,
724+
Computed: true,
717725
ValidateFunc: validation.FloatAtLeast(0),
718726
Description: `CPU request and limit for Airflow web server.`,
719727
},
720728
"memory_gb": {
721729
Type: schema.TypeFloat,
722730
Optional: true,
723731
ForceNew: false,
732+
Computed: true,
724733
ValidateFunc: validation.FloatAtLeast(0),
725734
Description: `Memory (GB) request and limit for Airflow web server.`,
726735
},
727736
"storage_gb": {
728737
Type: schema.TypeFloat,
729738
Optional: true,
730739
ForceNew: false,
740+
Computed: true,
731741
ValidateFunc: validation.FloatAtLeast(0),
732742
Description: `Storage (GB) request and limit for Airflow web server.`,
733743
},
@@ -739,6 +749,7 @@ func ResourceComposerEnvironment() *schema.Resource {
739749
Optional: true,
740750
AtLeastOneOf: workloadsConfigKeys,
741751
ForceNew: false,
752+
Computed: true,
742753
Description: `Configuration for resources used by Airflow workers.`,
743754
MaxItems: 1,
744755
Elem: &schema.Resource{
@@ -747,34 +758,39 @@ func ResourceComposerEnvironment() *schema.Resource {
747758
Type: schema.TypeFloat,
748759
Optional: true,
749760
ForceNew: false,
761+
Computed: true,
750762
ValidateFunc: validation.FloatAtLeast(0),
751763
Description: `CPU request and limit for a single Airflow worker replica.`,
752764
},
753765
"memory_gb": {
754766
Type: schema.TypeFloat,
755767
Optional: true,
756768
ForceNew: false,
769+
Computed: true,
757770
ValidateFunc: validation.FloatAtLeast(0),
758771
Description: `Memory (GB) request and limit for a single Airflow worker replica.`,
759772
},
760773
"storage_gb": {
761774
Type: schema.TypeFloat,
762775
Optional: true,
763776
ForceNew: false,
777+
Computed: true,
764778
ValidateFunc: validation.FloatAtLeast(0),
765779
Description: `Storage (GB) request and limit for a single Airflow worker replica.`,
766780
},
767781
"min_count": {
768782
Type: schema.TypeInt,
769783
Optional: true,
770784
ForceNew: false,
785+
Computed: true,
771786
ValidateFunc: validation.IntAtLeast(0),
772787
Description: `Minimum number of workers for autoscaling.`,
773788
},
774789
"max_count": {
775790
Type: schema.TypeInt,
776791
Optional: true,
777792
ForceNew: false,
793+
Computed: true,
778794
ValidateFunc: validation.IntAtLeast(0),
779795
Description: `Maximum number of workers for autoscaling.`,
780796
},

website/docs/r/composer_environment.html.markdown

+23
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,11 @@ The following arguments are supported:
475475
(Optional, Cloud Composer 1 with Airflow 2 only)
476476
The number of schedulers for Airflow.
477477

478+
* `web_server_plugins_mode` -
479+
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only)
480+
Web server plugins configuration. Should be either 'ENABLED' or 'DISABLED'. Defaults to 'ENABLED'.
481+
482+
478483
See [documentation](https://cloud.google.com/composer/docs/how-to/managing/configuring-private-ip) for setting up private environments. <a name="nested_private_environment_config"></a>The `private_environment_config` block supports:
479484

480485
* `connection_type` -
@@ -979,6 +984,10 @@ The `workloads_config` block supports:
979984
(Optional)
980985
Configuration for resources used by Airflow workers.
981986

987+
* `dag_processor` -
988+
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only)
989+
Configuration for resources used by DAG processor.
990+
982991
The `scheduler` block supports:
983992

984993
* `cpu` -
@@ -1050,6 +1059,20 @@ The `worker` block supports:
10501059
environment does not go above this number, even if a higher number of workers is required to
10511060
handle the load.
10521061

1062+
The `dag_processor` block supports:
1063+
1064+
* `cpu` -
1065+
(Optional)
1066+
CPU request and limit for DAG processor.
1067+
1068+
* `memory_gb` -
1069+
(Optional)
1070+
Memory (GB) request and limit for DAG processor.
1071+
1072+
* `float storage_gb`
1073+
(Optional)
1074+
Storage (GB) request and limit for DAG processor.
1075+
10531076
## Attributes Reference
10541077

10551078
In addition to the arguments listed above, the following computed attributes are exported:

0 commit comments

Comments
 (0)