Skip to content

Commit d1539f1

Browse files
authored
Merge pull request #21941 from wedge-jarrad/f-aws_mwaa_environment-schedulers
Support schedulers argument in aws_mwaa_environment
2 parents ca20eb9 + 8d81aa8 commit d1539f1

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

.changelog/21941.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/aws_mwaa_environment: Add `schedulers` argument
3+
```

internal/service/mwaa/environment.go

+14
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ func ResourceEnvironment() *schema.Resource {
199199
Type: schema.TypeString,
200200
Optional: true,
201201
},
202+
"schedulers": {
203+
Type: schema.TypeInt,
204+
Optional: true,
205+
Computed: true,
206+
},
202207
"service_role_arn": {
203208
Type: schema.TypeString,
204209
Computed: true,
@@ -292,6 +297,10 @@ func resourceEnvironmentCreate(d *schema.ResourceData, meta interface{}) error {
292297
input.RequirementsS3Path = aws.String(v.(string))
293298
}
294299

300+
if v, ok := d.GetOk("schedulers"); ok {
301+
input.Schedulers = aws.Int64(int64(v.(int)))
302+
}
303+
295304
if v, ok := d.GetOk("webserver_access_mode"); ok {
296305
input.WebserverAccessMode = aws.String(v.(string))
297306
}
@@ -366,6 +375,7 @@ func resourceEnvironmentRead(d *schema.ResourceData, meta interface{}) error {
366375
d.Set("plugins_s3_path", environment.PluginsS3Path)
367376
d.Set("requirements_s3_object_version", environment.RequirementsS3ObjectVersion)
368377
d.Set("requirements_s3_path", environment.RequirementsS3Path)
378+
d.Set("schedulers", environment.Schedulers)
369379
d.Set("service_role_arn", environment.ServiceRoleArn)
370380
d.Set("source_bucket_arn", environment.SourceBucketArn)
371381
d.Set("status", environment.Status)
@@ -452,6 +462,10 @@ func resourceEnvironmentUpdate(d *schema.ResourceData, meta interface{}) error {
452462
input.RequirementsS3Path = aws.String(d.Get("requirements_s3_path").(string))
453463
}
454464

465+
if d.HasChange("schedulers") {
466+
input.Schedulers = aws.Int64(int64(d.Get("schedulers").(int)))
467+
}
468+
455469
if d.HasChange("source_bucket_arn") {
456470
input.SourceBucketArn = aws.String(d.Get("source_bucket_arn").(string))
457471
}

internal/service/mwaa/environment_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func TestAccMWAAEnvironment_basic(t *testing.T) {
6060
resource.TestCheckResourceAttr(resourceName, "network_configuration.#", "1"),
6161
resource.TestCheckResourceAttr(resourceName, "network_configuration.0.security_group_ids.#", "1"),
6262
resource.TestCheckResourceAttr(resourceName, "network_configuration.0.subnet_ids.#", "2"),
63+
resource.TestCheckResourceAttr(resourceName, "schedulers", "2"),
6364
resource.TestCheckResourceAttrSet(resourceName, "service_role_arn"),
6465
acctest.CheckResourceAttrGlobalARNNoAccount(resourceName, "source_bucket_arn", "s3", rName),
6566
resource.TestCheckResourceAttrSet(resourceName, "status"),
@@ -287,6 +288,7 @@ func TestAccMWAAEnvironment_full(t *testing.T) {
287288
resource.TestCheckResourceAttr(resourceName, "network_configuration.0.subnet_ids.#", "2"),
288289
resource.TestCheckResourceAttr(resourceName, "plugins_s3_path", "plugins.zip"),
289290
resource.TestCheckResourceAttr(resourceName, "requirements_s3_path", "requirements.txt"),
291+
resource.TestCheckResourceAttr(resourceName, "schedulers", "1"),
290292
resource.TestCheckResourceAttrSet(resourceName, "service_role_arn"),
291293
acctest.CheckResourceAttrGlobalARNNoAccount(resourceName, "source_bucket_arn", "s3", rName),
292294
resource.TestCheckResourceAttrSet(resourceName, "status"),
@@ -729,6 +731,7 @@ resource "aws_mwaa_environment" "test" {
729731
730732
plugins_s3_path = aws_s3_object.plugins.key
731733
requirements_s3_path = aws_s3_object.requirements.key
734+
schedulers = 1
732735
source_bucket_arn = aws_s3_bucket.test.arn
733736
webserver_access_mode = "PUBLIC_ONLY"
734737
weekly_maintenance_window_start = "SAT:03:00"

website/docs/r/mwaa_environment.html.markdown

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ The following arguments are supported:
141141
* `plugins_s3_path` - (Optional) The relative path to the plugins.zip file on your Amazon S3 storage bucket. For example, plugins.zip. If a relative path is provided in the request, then plugins_s3_object_version is required. For more information, see [Importing DAGs on Amazon MWAA](https://docs.aws.amazon.com/mwaa/latest/userguide/configuring-dag-import.html).
142142
* `requirements_s3_object_version` - (Optional) The requirements.txt file version you want to use.
143143
* `requirements_s3_path` - (Optional) The relative path to the requirements.txt file on your Amazon S3 storage bucket. For example, requirements.txt. If a relative path is provided in the request, then requirements_s3_object_version is required. For more information, see [Importing DAGs on Amazon MWAA](https://docs.aws.amazon.com/mwaa/latest/userguide/configuring-dag-import.html).
144+
* `schedulers` - (Optional) The number of schedulers that you want to run in your environment. v2.0.2 and above accepts `2` - `5`, default `2`. v1.10.12 accepts `1`.
144145
* `source_bucket_arn` - (Required) The Amazon Resource Name (ARN) of your Amazon S3 storage bucket. For example, arn:aws:s3:::airflow-mybucketname.
145146
* `webserver_access_mode` - (Optional) Specifies whether the webserver should be accessible over the internet or via your specified VPC. Possible options: `PRIVATE_ONLY` (default) and `PUBLIC_ONLY`.
146147
* `weekly_maintenance_window_start` - (Optional) Specifies the start date for the weekly maintenance window.

0 commit comments

Comments
 (0)