|
| 1 | +# Upgrade from v2.x to v3.x |
| 2 | + |
| 3 | +If you have any questions regarding this upgrade process, please consult the [`examples`](https://github.com/terraform-aws-modules/terraform-aws-emr/tree/master/examples) directory: |
| 4 | +If you find a bug, please open an issue with supporting configuration to reproduce. |
| 5 | + |
| 6 | +## List of backwards incompatible changes |
| 7 | + |
| 8 | +- Terraform `v1.5.7` is now minimum supported version |
| 9 | +- AWS provider `v6.19` is now minimum supported version |
| 10 | +- Kubernetes provider `v2.38` is now minimum supported version (EMR on EKS virtual cluster sub-module) |
| 11 | +- `aws_security_group_rule` resources have been split into `aws_vpc_security_group_ingress_rule` and `aws_vpc_security_group_egress_rule` resources to better match the AWS API and allow for more flexibility in defining security group rules. Prior variable names of `*_security_group_rules` have been split into `*_security_group_ingress_rules` and `*_security_group_egress_rules` to match. |
| 12 | + |
| 13 | +## Additional changes |
| 14 | + |
| 15 | +### Added |
| 16 | + |
| 17 | +- Support for `region` parameter to specify the AWS region for the resources created if different from the provider region. |
| 18 | + |
| 19 | +### Modified |
| 20 | + |
| 21 | +- Variable definitions now contain detailed `object` types in place of the previously used any type. |
| 22 | +- Ensure data sources are gated behind `create` flags to prevent unnecessary API calls. |
| 23 | +- `release_label_filters.prefix` now defaults to `emr-7`, was previously `emr-6`. |
| 24 | +- `unhealthy_node_replacement` now defaults to `true` |
| 25 | +- `aws_service_principal` data source is now used to fetch the correct service principals (instead of trying to construct them psuedo-manually with the DNS suffix). |
| 26 | + |
| 27 | +### Variable and output changes |
| 28 | + |
| 29 | +1. Removed variables: |
| 30 | + |
| 31 | + - `serverless` sub-module |
| 32 | + - None |
| 33 | + |
| 34 | + - `studio` sub-module |
| 35 | + - None |
| 36 | + |
| 37 | + - `virtual_cluster` sub-module |
| 38 | + |
| 39 | +2. Renamed variables: |
| 40 | + |
| 41 | + - `master_security_group_rules` -> `master_security_group_ingress_rules` and `master_security_group_egress_rules` |
| 42 | + - `slave_security_group_rules` -> `slave_security_group_ingress_rules` and `slave_security_group_egress_rules` |
| 43 | + - `service_security_group_rules` -> `service_security_group_ingress_rules` and `service_security_group_egress_rules` |
| 44 | + |
| 45 | + - `serverless` sub-module |
| 46 | + - `security_group_rules` -> `security_group_ingress_rules` and `security_group_egress_rules` |
| 47 | + - `release_label_prefix` -> `release_label_filters` |
| 48 | + |
| 49 | + - `studio` sub-module |
| 50 | + - `engine_security_group_rules` -> `engine_security_group_ingress_rules` and `engine_security_group_egress_rules` |
| 51 | + - `workspace_security_group_rules` -> `workspace_security_group_ingress_rules` and `workspace_security_group_egress_rules` |
| 52 | + |
| 53 | + - `virtual_cluster` sub-module |
| 54 | + - `eks_cluster_id` -> `eks_cluster_name` to better match API of EKS module/resources |
| 55 | + - `oidc_provider_arn` -> `eks_oidc_provider_arn` for clarity to show its related to EKS authentication |
| 56 | + |
| 57 | +3. Added variables: |
| 58 | + |
| 59 | + - `os_release_label` |
| 60 | + |
| 61 | + - `serverless` sub-module |
| 62 | + - `monitoring_configuration` |
| 63 | + - `runtime_configuration` |
| 64 | + - `scheduler_configuration` |
| 65 | + |
| 66 | + - `studio` sub-module |
| 67 | + - None |
| 68 | + |
| 69 | + - `virtual_cluster` sub-module |
| 70 | + - `cloudwatch_log_group_class` |
| 71 | + |
| 72 | +4. Removed outputs: |
| 73 | + |
| 74 | + - `serverless` sub-module |
| 75 | + - None |
| 76 | + |
| 77 | + - `studio` sub-module |
| 78 | + - None |
| 79 | + |
| 80 | + - `virtual_cluster` sub-module |
| 81 | + |
| 82 | +5. Renamed outputs: |
| 83 | + |
| 84 | + - `serverless` sub-module |
| 85 | + - None |
| 86 | + |
| 87 | + - `studio` sub-module |
| 88 | + - None |
| 89 | + |
| 90 | + - `virtual_cluster` sub-module |
| 91 | + - None |
| 92 | + |
| 93 | +6. Added outputs: |
| 94 | + |
| 95 | + - `serverless` sub-module |
| 96 | + - None |
| 97 | + |
| 98 | + - `studio` sub-module |
| 99 | + - None |
| 100 | + |
| 101 | + - `virtual_cluster` sub-module |
| 102 | + - None |
| 103 | + |
| 104 | +## Upgrade Migration |
| 105 | + |
| 106 | +### Before v2.x Example |
| 107 | + |
| 108 | +```hcl |
| 109 | +module "emr" { |
| 110 | + source = "terraform-aws-modules/emr/aws" |
| 111 | + version = "~> 2.0" |
| 112 | +
|
| 113 | + # Only the affected attributes are shown |
| 114 | +
|
| 115 | + bootstrap_action = { |
| 116 | + example = { |
| 117 | + name = "Just an example", |
| 118 | + path = "file:/bin/echo", |
| 119 | + args = ["Hello World!"] |
| 120 | + } |
| 121 | + } |
| 122 | +} |
| 123 | +``` |
| 124 | + |
| 125 | +### After v3.x Example |
| 126 | + |
| 127 | +```hcl |
| 128 | +module "emr" { |
| 129 | + source = "terraform-aws-modules/emr/aws" |
| 130 | + version = "~> 3.0" |
| 131 | +
|
| 132 | + # Only the affected attributes are shown |
| 133 | +
|
| 134 | + # Copy and paste from output to maintain backwards compatibility |
| 135 | + # This was added by the AWS EMR API and provider in v6.x |
| 136 | + os_release_label = "2023.9.20251014.0" |
| 137 | +
|
| 138 | + bootstrap_action = [ |
| 139 | + { |
| 140 | + name = "Just an example", |
| 141 | + path = "file:/bin/echo", |
| 142 | + args = ["Hello World!"] |
| 143 | + } |
| 144 | + ] |
| 145 | +} |
| 146 | +``` |
| 147 | + |
| 148 | +### State Changes |
| 149 | + |
| 150 | +Due to the change from `aws_security_group_rule` to `aws_vpc_security_group_ingress_rule` and `aws_vpc_security_group_egress_rule`, the following reference state changes are required to maintain the current security group rules. (Note: these are different resources so they cannot be moved with `terraform mv ...`) |
| 151 | + |
| 152 | +#### Instance Group |
| 153 | + |
| 154 | +```sh |
| 155 | +# Master Security Group |
| 156 | +terraform state rm 'module.emr_instance_group.aws_security_group_rule.master["default"]' |
| 157 | +terraform state import 'module.emr_instance_group.aws_vpc_security_group_egress_rule.master["all-traffic"]' 'sg-xxx' |
| 158 | + |
| 159 | +# Slave Security Group |
| 160 | +terraform state rm 'module.emr_instance_group.aws_security_group_rule.slave["default"]' |
| 161 | +terraform state import 'module.emr_instance_group.aws_vpc_security_group_egress_rule.slave["all-traffic"]' 'sg-xxx' |
| 162 | + |
| 163 | +# Service Security Group |
| 164 | +terraform state rm 'module.emr_instance_group.aws_security_group_rule.service["master_9443_ingress"]' |
| 165 | +terraform state import 'module.emr_instance_group.aws_vpc_security_group_ingress_rule.service["master_9443"]' 'sg-xxx' |
| 166 | + |
| 167 | +terraform state rm 'module.emr_instance_group.aws_security_group_rule.service["master_9443_egress"]' |
| 168 | +terraform state import 'module.emr_instance_group.aws_vpc_security_group_egress_rule.service["master_8443"]' 'sg-xxx' |
| 169 | + |
| 170 | +terraform state rm 'module.emr_instance_group.aws_security_group_rule.service["core_task_8443_egress"]' |
| 171 | +terraform state import 'module.emr_instance_group.aws_vpc_security_group_egress_rule.service["core_task_8443"]' 'sg-xxx' |
| 172 | +``` |
| 173 | + |
| 174 | +#### Instance Fleet |
| 175 | + |
| 176 | +```sh |
| 177 | +# Master Security Group |
| 178 | +terraform state rm 'module.emr_instance_fleet.aws_security_group_rule.master["default"]' |
| 179 | +terraform state import 'module.emr_instance_fleet.aws_vpc_security_group_egress_rule.master["all-traffic"]' 'sg-xxx' |
| 180 | + |
| 181 | +# Slave Security Group |
| 182 | +terraform state rm 'module.emr_instance_fleet.aws_security_group_rule.slave["default"]' |
| 183 | +terraform state import 'module.emr_instance_fleet.aws_vpc_security_group_egress_rule.slave["all-traffic"]' 'sg-xxx' |
| 184 | + |
| 185 | +# Service Security Group |
| 186 | +terraform state rm 'module.emr_instance_fleet.aws_security_group_rule.service["master_9443_ingress"]' |
| 187 | +terraform state import 'module.emr_instance_fleet.aws_vpc_security_group_ingress_rule.service["master_9443"]' 'sg-xxx' |
| 188 | + |
| 189 | +terraform state rm 'module.emr_instance_fleet.aws_security_group_rule.service["master_9443_egress"]' |
| 190 | +terraform state import 'module.emr_instance_fleet.aws_vpc_security_group_egress_rule.service["master_8443"]' 'sg-xxx' |
| 191 | + |
| 192 | +terraform state rm 'module.emr_instance_fleet.aws_security_group_rule.service["core_task_8443_egress"]' |
| 193 | +terraform state import 'module.emr_instance_fleet.aws_vpc_security_group_egress_rule.service["core_task_8443"]' 'sg-xxx' |
| 194 | +``` |
| 195 | + |
| 196 | +#### Serverless sub-module |
| 197 | + |
| 198 | +```sh |
| 199 | +terraform state rm 'module.emr_serverless_spark.aws_security_group_rule.this["egress_all"]' |
| 200 | +terraform state import 'module.emr_serverless_spark.aws_vpc_security_group_egress_rule.this["all-traffic"]' 'sg-xxx' |
| 201 | +``` |
0 commit comments