Skip to content

Commit a0d69a2

Browse files
authored
feat(p4): allow users to specify a private ip (aws-games#665)
1 parent 3c8d9d1 commit a0d69a2

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

modules/perforce/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ module "p4_server" {
5151
# Networking & Security
5252
vpc_id = var.vpc_id
5353
instance_subnet_id = var.p4_server_config.instance_subnet_id
54+
instance_private_ip = var.p4_server_config.instance_private_ip
5455
create_default_sg = var.p4_server_config.create_default_sg
5556
existing_security_groups = var.p4_server_config.existing_security_groups
5657
internal = var.p4_server_config.internal

modules/perforce/modules/p4-server/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ If you do not provide these the module will create a random Super User and creat
5353

5454
| Name | Version |
5555
|------|---------|
56-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.89.0 |
56+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.97.0 |
5757
| <a name="provider_awscc"></a> [awscc](#provider\_awscc) | 1.34.0 |
5858
| <a name="provider_netapp-ontap"></a> [netapp-ontap](#provider\_netapp-ontap) | 2.1.0 |
5959
| <a name="provider_random"></a> [random](#provider\_random) | 3.7.1 |
@@ -128,6 +128,7 @@ No modules.
128128
| <a name="input_fsxn_svm_name"></a> [fsxn\_svm\_name](#input\_fsxn\_svm\_name) | FSxN storage virtual machine name | `string` | `null` | no |
129129
| <a name="input_fully_qualified_domain_name"></a> [fully\_qualified\_domain\_name](#input\_fully\_qualified\_domain\_name) | The fully qualified domain name where P4 Server will be available. This is used to generate self-signed certificates on the P4 Server. | `string` | `null` | no |
130130
| <a name="input_instance_architecture"></a> [instance\_architecture](#input\_instance\_architecture) | The architecture of the P4 Server instance. Allowed values are 'arm64' or 'x86\_64'. | `string` | `"x86_64"` | no |
131+
| <a name="input_instance_private_ip"></a> [instance\_private\_ip](#input\_instance\_private\_ip) | The private IP address to assign to the P4 Server. | `string` | `null` | no |
131132
| <a name="input_instance_subnet_id"></a> [instance\_subnet\_id](#input\_instance\_subnet\_id) | The subnet where the P4 Server instance will be deployed. | `string` | n/a | yes |
132133
| <a name="input_instance_type"></a> [instance\_type](#input\_instance\_type) | The instance type for Perforce P4 Server. Defaults to c6g.large. | `string` | `"c6i.large"` | no |
133134
| <a name="input_internal"></a> [internal](#input\_internal) | Set this flag to true if you do not want the P4 Server instance to have a public IP. | `bool` | `false` | no |
@@ -140,9 +141,9 @@ No modules.
140141
| <a name="input_protocol"></a> [protocol](#input\_protocol) | Specify the protocol (NFS or ISCSI) | `string` | `null` | no |
141142
| <a name="input_selinux"></a> [selinux](#input\_selinux) | Whether to apply SELinux label updates for P4 Server. Don't enable this if SELinux is disabled on your target operating system. | `bool` | `false` | no |
142143
| <a name="input_storage_type"></a> [storage\_type](#input\_storage\_type) | The type of backing store [EBS, FSxN] | `string` | n/a | yes |
143-
| <a name="input_super_user_password_secret_arn"></a> [super\_user\_password\_secret\_arn](#input\_super\_user\_password\_secret\_arn) | If you would like to manage your own super user credentials through AWS Secrets Manager provide the ARN for the super user's username here. Otherwise, the default of 'perforce' will be used. | `string` | `null` | no |
144-
| <a name="input_super_user_username_secret_arn"></a> [super\_user\_username\_secret\_arn](#input\_super\_user\_username\_secret\_arn) | If you would like to manage your own super user credentials through AWS Secrets Manager provide the ARN for the super user's password here. | `string` | `null` | no |
145-
| <a name="input_tags"></a> [tags](#input\_tags) | Tags to apply to resources. | `map(any)` | <pre>{<br> "IaC": "Terraform",<br> "ModuleBy": "CGD-Toolkit",<br> "ModuleName": "p4-server",<br> "ModuleSource": "https://github.com/aws-games/cloud-game-development-toolkit/tree/main/modules/perforce/terraform-aws-perforce",<br> "RootModuleName": "terraform-aws-perforce"<br>}</pre> | no |
144+
| <a name="input_super_user_password_secret_arn"></a> [super\_user\_password\_secret\_arn](#input\_super\_user\_password\_secret\_arn) | If you would like to manage your own super user credentials through AWS Secrets Manager provide the ARN for the super user's password here. | `string` | `null` | no |
145+
| <a name="input_super_user_username_secret_arn"></a> [super\_user\_username\_secret\_arn](#input\_super\_user\_username\_secret\_arn) | If you would like to manage your own super user credentials through AWS Secrets Manager provide the ARN for the super user's username here. Otherwise, the default of 'perforce' will be used. | `string` | `null` | no |
146+
| <a name="input_tags"></a> [tags](#input\_tags) | Tags to apply to resources. | `map(any)` | <pre>{<br/> "IaC": "Terraform",<br/> "ModuleBy": "CGD-Toolkit",<br/> "ModuleName": "p4-server",<br/> "ModuleSource": "https://github.com/aws-games/cloud-game-development-toolkit/tree/main/modules/perforce/terraform-aws-perforce",<br/> "RootModuleName": "terraform-aws-perforce"<br/>}</pre> | no |
146147
| <a name="input_unicode"></a> [unicode](#input\_unicode) | Whether to enable Unicode configuration for P4 Server the -xi flag for p4d. Set to true to enable Unicode support. | `bool` | `false` | no |
147148
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | The VPC where P4 Server should be deployed | `string` | n/a | yes |
148149

@@ -156,6 +157,6 @@ No modules.
156157
| <a name="output_lambda_link_name"></a> [lambda\_link\_name](#output\_lambda\_link\_name) | Lambda function name for the FSxN Link |
157158
| <a name="output_private_ip"></a> [private\_ip](#output\_private\_ip) | Private IP for the P4 Server instance |
158159
| <a name="output_security_group_id"></a> [security\_group\_id](#output\_security\_group\_id) | The default security group of your P4 Server instance. |
159-
| <a name="output_super_user_password_secret_arn"></a> [super\_user\_password\_secret\_arn](#output\_super\_user\_password\_secret\_arn) | The ARN of the AWS Secrets Manager secret holding your P4 Server super user's username. |
160-
| <a name="output_super_user_username_secret_arn"></a> [super\_user\_username\_secret\_arn](#output\_super\_user\_username\_secret\_arn) | The ARN of the AWS Secrets Manager secret holding your P4 Server super user's password. |
160+
| <a name="output_super_user_password_secret_arn"></a> [super\_user\_password\_secret\_arn](#output\_super\_user\_password\_secret\_arn) | The ARN of the AWS Secrets Manager secret holding your P4 Server super user's password. |
161+
| <a name="output_super_user_username_secret_arn"></a> [super\_user\_username\_secret\_arn](#output\_super\_user\_username\_secret\_arn) | The ARN of the AWS Secrets Manager secret holding your P4 Server super user's username. |
161162
<!-- END_TF_DOCS -->

modules/perforce/modules/p4-server/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Perforce P4 Server Super User
33
##########################################
44
resource "awscc_secretsmanager_secret" "super_user_password" {
5-
count = var.super_user_password_secret_arn == null ? 1 : 0
5+
count = var.super_user_password_secret_arn == null ? 1 : 0
66
name = "${local.name_prefix}-SuperUserPassword"
77
description = "The password for the created P4 Server super user."
88
generate_secret_string = {
@@ -13,7 +13,7 @@ resource "awscc_secretsmanager_secret" "super_user_password" {
1313
}
1414

1515
resource "awscc_secretsmanager_secret" "super_user_username" {
16-
count = var.super_user_username_secret_arn == null ? 1 : 0
16+
count = var.super_user_username_secret_arn == null ? 1 : 0
1717
name = "${local.name_prefix}-SuperUserUsername"
1818
description = "The username for the created P4 Server super user."
1919
secret_string = "perforce"
@@ -79,6 +79,7 @@ resource "aws_instance" "server_instance" {
7979

8080
availability_zone = local.p4_server_az
8181
subnet_id = var.instance_subnet_id
82+
private_ip = var.instance_private_ip
8283

8384
iam_instance_profile = aws_iam_instance_profile.instance_profile.id
8485

modules/perforce/modules/p4-server/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ variable "instance_subnet_id" {
215215
description = "The subnet where the P4 Server instance will be deployed."
216216
}
217217

218+
variable "instance_private_ip" {
219+
type = string
220+
description = "The private IP address to assign to the P4 Server."
221+
default = null
222+
}
223+
218224
variable "create_default_sg" {
219225
type = bool
220226
description = "Whether to create a default security group for the P4 Server instance."

modules/perforce/variables.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ variable "p4_server_config" {
209209

210210
# Networking & Security
211211
instance_subnet_id = optional(string, null)
212+
instance_private_ip = optional(string, null)
212213
create_default_sg = optional(bool, true)
213214
existing_security_groups = optional(list(string), [])
214215
internal = optional(bool, false)
@@ -277,6 +278,8 @@ variable "p4_server_config" {
277278
# - Networking & Security -
278279
instance_subnet_id: "The subnet where the P4 Server instance will be deployed."
279280
281+
instance_private_ip: "The private IP address to assign to the P4 Server."
282+
280283
create_default_sg : "Whether to create a default security group for the P4 Server instance."
281284
282285
existing_security_groups: "A list of existing security group IDs to attach to the P4 Server load balancer."

0 commit comments

Comments
 (0)