we have a terraform script to create a Aurora (postgresql) instance with one database. We can login to the terminal and create a new database in the same database instance identifier. Is there a way to do that in the terraform script directly?
could not find any thing on the internet and trying to duplicate the
resource "aws_rds_cluster" failed.
You can use postgresql provider and define postgresql_role and postgresql_database.
Related
How do you restore an azure sql database using terraform on another server from a backup?
Terraform docs talk about a create mode "RestoreExternalBackup". How could one use that?
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mssql_database
I researched this issue and found it to be a discrepancy between the Terraform and Azure documentation. I also opened an issue on the GitHub repo with this info.
RestoreExternalBackup is listed as a possible value for CreateMode in the Azure API documentation for databases. However, the create mode documentation doesn't describe how to use it. This option should not be available.
Looking at the Managed Database documentation, it clearly defines how to use the RestoreExternalBackup option. Oddly enough the Terraform documentation doesnt list any create modes for managed databases. https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mssql_managed_database
When trying to use RestoreExternalBackup to create a database the error indicates that option requires a pointer to a storage account with the message "Missing storage container URI". Storage account information is not a valid property when creating a database resource, only for a managed database resource.
Database = https://learn.microsoft.com/en-us/rest/api/sql/2022-05-01-preview/databases/create-or-update?tabs=HTTP
Managed Database Docs = https://learn.microsoft.com/en-us/rest/api/sql/2022-05-01-preview/managed-databases/create-or-update?tabs=HTTP
According to this doc :
You can require that all user connections to your Aurora MySQL DB cluster use SSL/TLS by using the require_secure_transport DB cluster parameter.
Been looking through terraform docs and samples. Not seeing if this setting is available.
Does terraform have a method to set arbitrary values if they aren't supported as module params?
#ethrbunny If my guess is not wrong, you are trying to set SSL/TLS connection for mysql DB cluster in aws aurora using terraform? I guess for this first you need to create custom DB cluster parameter group in aws aurora and specify that group name in your terraform module.
Reference :
Terraform Registery Look for 'db_cluster_parameter_group_name' tag
Terraform aws aurora github link
As per AWS document we can set this parameter in a custom DB cluster parameter group. The parameter isn't available in DB instance parameter groups.
Reference : aws aurora documentation refer 'Notes' section
The require_secure_transport parameter is only available for Aurora MySQL version 5.7. You can set this parameter in a custom DB cluster parameter group. The parameter isn't available in DB instance parameter groups.
I use the terraform module, terraform-aws-modules/rds/aws (version: 2.20.0) provisioned MariaDB master and a replica. I would like to promote the replica to be a standalone DB instance. The document at https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html gives instruction of how to do it via AWS console. I would like to do it use terraform script. Anyone has idea of how to promote a replica to be a standalone DB instance using terraform script? My terraform version is v01.3.5.
I a guessing you have the read replica resource via terraform.
From docs:
Removing the replicate_source_db attribute from an existing RDS
Replicate database managed by Terraform will promote the database to a
fully standalone database.
You can make a condition there to switch it on and off.
I am creating an EMR cluster using the aws_emr_cluster resource in terraform.
I need to get access to the instance ID of the underlying EC2 hardware, specifically the MASTER node.
It does not appear in the attributes and neither when I perform an terraform show
The data definitely exists and is available in AWS.
Does anyone know how I can get at this value and how to do it it using terraform?
You won't be able to access the nodes (EC2 Instances) in an EMR Cluster through terraform. It is the same case for AutoScaling Groups too.
If terraform includes EMR or ASG nodes, state file will be changed everytime a change happens in EMR/ASG. So, storing the instance information won't be ideal for terraform.
Instead, you can use AWS SDK/CLI/boto3 to see them.
Thanks.
I have different EC2 instances trying to access RDS instance. I want to upfront set RDS instance 'canonical name' within configuration file so that after deployment I don't need to make any changes to configuration files.
I have following questions:
Is there anyway, one can assign canonical name to a RDS instance within cloudformation template?
If above is not possible, can I setup dependency chain between EC2 creation and RDS instance (i.e. create RDS instance first, query it's name/ip and than create EC2 instance)
Thx
The canonical name of an RDS instance will always be generated automatically by AWS, however the naming scheme is consistent. The format of the name is:
<instance_name>.<arbitrary_string>.<region>.rds.amazonaws.com
The arbitrary_string section of the name is a string that uniquely identifies your AWS account. All RDS instances created within your account will use the same string identifier, so just grab that section from an existing RDS instance and you can piece together the full name based on the name you give the database and the region you launch it in.
If you want to have an easy to read/remember DNS name then you can always use Route 53 to assign another name as an alias to this.