Open dbadrak opened 4 years ago
resource "aws_db_option_group" "baseline" {
name = "baseline-oracle-ee-12-1"
major_engine_version = "12.1"
option_group_description = "baseline oracle ee option group"
engine_name = "oracle-ee"
}
# Use a local-exec provisioner to run AWS CLI commands after the resource is created
resource "null_resource" "update_option_group" {
triggers = {
option_group_id = aws_db_option_group.baseline.id
}
provisioner "local-exec" {
command = <<-EOT
aws rds modify-option-group \
--option-group-name ${aws_db_option_group.baseline.name} \
--options "OptionName=VPCSecurityGroupMemberships,Port=1521,OptionSettings=[{Name=VPCSecurityGroupMemberships,Value=vpc-12345678},{Name=AllowVpcAndNonVpcInstanceMemberships,Value=true}]"
EOT
}
}
first create the aws_db_option_group resource with the basic settings.
use a null_resource with a local-exec provisioner to run an AWS CLI command (aws rds modify-option-group) after the aws_db_option_group resource is created.
The AWS CLI command modifies the option group and sets the VPC ID (vpc-12345678) and allows VPC and non-VPC instance memberships (AllowVpcAndNonVpcInstanceMemberships=true).
Community Note
Description
Certain features for creating DB Options groups for oracle are missing from the AWS provider. Setting a VPC id, or allowing vpc and non-vpc resources.
New or Affected Resource(s)
Potential Terraform Configuration
References
https://docs.aws.amazon.com/cli/latest/reference/rds/create-option-group.html
0000