Skip to content

Commit d5d9856

Browse files
fix(microvm): support plan-known provider selection
1 parent e789b1a commit d5d9856

9 files changed

Lines changed: 28 additions & 12 deletions

File tree

modules/compute-providers/aws/microvm/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ The resolved provider-neutral `runner.iam.role` is passed to Lambda as the Micro
1010
## Requirements
1111

1212
| Name | Version |
13-
| ---- | ------- |
13+
|------|---------|
1414
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.4.0 |
1515
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.33 |
1616

1717
## Providers
1818

1919
| Name | Version |
20-
| ---- | ------- |
20+
|------|---------|
2121
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.33 |
2222
| <a name="provider_terraform"></a> [terraform](#provider\_terraform) | n/a |
2323

@@ -28,7 +28,7 @@ No modules.
2828
## Resources
2929

3030
| Name | Type |
31-
| ---- | ---- |
31+
|------|------|
3232
| [aws_cloudwatch_log_group.runtime](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
3333
| [terraform_data.validate_config](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/resources/data) | resource |
3434
| [terraform_data.validate_runner](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/resources/data) | resource |
@@ -41,7 +41,7 @@ No modules.
4141
## Inputs
4242

4343
| Name | Description | Type | Default | Required |
44-
| ---- | ----------- | ---- | ------- | :------: |
44+
|------|-------------|------|---------|:--------:|
4545
| <a name="input_aws_partition"></a> [aws\_partition](#input\_aws\_partition) | AWS partition used to construct IAM ARNs. | `string` | `"aws"` | no |
4646
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS region used by compute-provider resources and policy documents. | `string` | n/a | yes |
4747
| <a name="input_config"></a> [config](#input\_config) | Lambda MicroVM compute-provider configuration. Paths match `compute_provider.aws.microvm` in runner-config.<br/><br/>- `image_arn`: ARN of the MicroVM image used to run GitHub runners.<br/>- `image_version`: Optional MicroVM image version.<br/>- `ingress_network_connectors`: Up to 10 Lambda network-connector ARNs passed to RunMicrovm.<br/>- `egress_network_connectors`: Up to 10 Lambda network-connector ARNs passed to RunMicrovm.<br/>- `maximum_duration_in_seconds`: Optional maximum MicroVM lifetime. Valid values are integers from 1 through 28,800 seconds.<br/>- `environment_variables`: Additional provider-specific Lambda environment variables merged into scale-up, scale-down, and pool.<br/>- `iam.resource_arns.images`: MicroVM image ARNs allowed by RunMicrovm. The default is `["*"]`.<br/>- `iam.resource_arns.microvms`: MicroVM instance ARNs allowed by tagging and termination actions. The default is `["*"]`. Provider-required list and connector permissions remain separately scoped to `*`.<br/>- `iam.additional_policy_json.scale_up`: Optional additional provider policy attached separately to the scale-up Lambda role.<br/>- `iam.managed_policies.scale_up`: Optional managed-policy wrapper attached to the scale-up Lambda role. Wrapper presence controls resource creation during planning.<br/>- `iam.managed_policies.scale_up.arn`: ARN of the scale-up managed policy. The ARN may remain unknown until apply.<br/>- `iam.managed_policies.pool`: Optional managed-policy wrapper attached to the pool Lambda role. Wrapper presence controls resource creation during planning.<br/>- `iam.managed_policies.pool.arn`: ARN of the pool managed policy. The ARN may remain unknown until apply. | <pre>object({<br/> image_arn = string<br/> image_version = optional(string, null)<br/> ingress_network_connectors = optional(list(string), [])<br/> egress_network_connectors = optional(list(string), [])<br/> maximum_duration_in_seconds = optional(number, null)<br/> environment_variables = optional(map(string), {})<br/> iam = optional(object({<br/> resource_arns = optional(object({<br/> images = optional(list(string), ["*"])<br/> microvms = optional(list(string), ["*"])<br/> }), {})<br/> additional_policy_json = optional(object({<br/> scale_up = optional(string, null)<br/> }), {})<br/> managed_policies = optional(object({<br/> scale_up = optional(object({<br/> arn = string<br/> }), null)<br/> pool = optional(object({<br/> arn = string<br/> }), null)<br/> }), {})<br/> }), {})<br/> })</pre> | n/a | yes |
@@ -55,7 +55,7 @@ No modules.
5555
## Outputs
5656

5757
| Name | Description |
58-
| ---- | ----------- |
58+
|------|-------------|
5959
| <a name="output_environment_variables"></a> [environment\_variables](#output\_environment\_variables) | Provider-specific Lambda environment variable fragments consumed by runner-config. |
6060
| <a name="output_policies"></a> [policies](#output\_policies) | Provider-specific IAM policy fragments consumed by runner-config. |
6161
| <a name="output_provider"></a> [provider](#output\_provider) | Nested Lambda MicroVM compute-provider contract consumed by runner-config. |

modules/multi-runner/README.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

modules/multi-runner/tests/computed-runner-inputs.tftest.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ run "computed_lane_values_keep_enabled_binary_syncer_instances_plannable" {
8484
}
8585

8686
assert {
87-
condition = output.runner_config_keys == ["linux"]
87+
condition = output.runner_config_keys == ["linux", "micro"]
8888
error_message = "The explicit provider selection must keep runner-config dispatch plannable when unrelated lane values are known only after apply."
8989
}
9090

modules/multi-runner/tests/fixtures/computed-runner-inputs/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ module "multi_runner" {
8080
namespace = "aws"
8181
type = "ec2"
8282
}
83+
micro = {
84+
namespace = "aws"
85+
type = "microvm"
86+
}
8387
}
8488
aws = {
8589
ec2 = {

modules/multi-runner/tests/provider-routing-v2.tftest.hcl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4629,7 +4629,18 @@ run "experimental_v2_routes_microvm_only_without_ec2_binary_discovery" {
46294629
}
46304630
}
46314631
compute_provider = {
4632+
selections = {
4633+
micro = {
4634+
namespace = "aws"
4635+
type = "microvm"
4636+
}
4637+
}
46324638
aws = {
4639+
ec2 = {
4640+
runner_binaries = {
4641+
targets = {}
4642+
}
4643+
}
46334644
microvm = {
46344645
image_arn = "arn:aws:lambda:eu-west-1:123456789012:microvm-image:runner"
46354646
}

modules/multi-runner/validations.experimental.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ resource "terraform_data" "validate_experimental" {
7979
precondition {
8080
condition = var.experimental.compute_provider.selections == null ? true : alltrue([
8181
for selection in values(var.experimental.compute_provider.selections) :
82-
selection.namespace == "aws" && selection.type == "ec2"
82+
selection.namespace == "aws" && contains(["ec2", "microvm"], selection.type)
8383
])
84-
error_message = "experimental.compute_provider.selections supports only namespace = aws and type = ec2."
84+
error_message = "experimental.compute_provider.selections supports only namespace = aws and type = ec2 or microvm."
8585
}
8686

8787
precondition {

modules/multi-runner/variables.experimental.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ variable "experimental" {
172172
- `compute_provider`: Shared compute-provider defaults grouped first by cloud and then by provider type. Global defaults do not select a provider for any runner configuration.
173173
- `compute_provider.selections`: Optional plan-shaping map keyed by runner-configuration key. Each entry identifies the namespace and type of the configuration's selected compute-provider block. The default is null, which discovers selections from the typed provider blocks. Set this map when unrelated apply-time values make that discovery unknown; its keys and values must be known during planning and cover every runner configuration exactly once.
174174
- `compute_provider.selections[].namespace`: Compute-provider namespace. The only currently supported value is `aws`.
175-
- `compute_provider.selections[].type`: Compute-provider type within the namespace. The only currently supported value is `ec2`.
175+
- `compute_provider.selections[].type`: Compute-provider type within the namespace. Currently supported values are `ec2` and `microvm`.
176176
- `compute_provider.aws`: Shared defaults for AWS compute providers.
177177
- `compute_provider.aws.ec2`: Shared defaults for AWS EC2 runner configurations.
178178
- `compute_provider.aws.ec2.vpc_id`: Shared VPC default for v2 EC2 runner configurations. The default is null; every EC2 runner configuration must resolve this field globally or locally.

modules/runner-config/tests/pool.tftest.hcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ run "routes_lambda_microvm_provider" {
658658
command = plan
659659

660660
variables {
661+
compute_provider_key = "aws_microvm"
661662
runner = {
662663
os = "linux"
663664
architecture = "arm64"

modules/runner-config/variables.compute-provider.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ variable "compute_provider_key" {
55
default = null
66

77
validation {
8-
condition = var.compute_provider_key == null ? true : contains(["aws_ec2"], var.compute_provider_key)
9-
error_message = "compute_provider_key must be null or aws_ec2."
8+
condition = var.compute_provider_key == null ? true : contains(["aws_ec2", "aws_microvm"], var.compute_provider_key)
9+
error_message = "compute_provider_key must be null, aws_ec2, or aws_microvm."
1010
}
1111
}
1212

0 commit comments

Comments
 (0)