-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Azure example #36636
base: main
Are you sure you want to change the base?
Add Azure example #36636
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor suggestion -- approving so you're not blocked.
@@ -78,7 +78,7 @@ resource "aws_db_instance" "example" { | |||
|
|||
During a Terraform operation, the provider uses the `password_wo` value to create the database instance, and then Terraform discards that value without storing it in the plan or state file. | |||
|
|||
Note that the way this is written, the `password_wo` value is lost after Terraform generates unless we capture it in another resource or output. For example of generating, storing, retrieving, and using an ephemeral password as a write-only argument, refer to the [expanded example below](#example). | |||
Note that the way this is written, the `password_wo` value is lost after Terraform generates unless we capture it in another resource or output. For example of generating, storing, retrieving, and using an ephemeral password as a write-only argument, refer to the [expanded example below](#examples). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the way this is written, the `password_wo` value is lost after Terraform generates unless we capture it in another resource or output. For example of generating, storing, retrieving, and using an ephemeral password as a write-only argument, refer to the [expanded example below](#examples). | |
Note that Terraform does not store the generated value for `password_wo`, but you can capture it in another resource or output. For an example of generating, storing, retrieving, and using an ephemeral password as a write-only argument, refer to [Examples](#examples). |
Replace "the way this is written" with more concrete language.
@@ -167,4 +171,30 @@ In the above example, the ephemeral resource `aws_secretsmanager_secret_version` | |||
|
|||
Terraform first creates the secret in AWS Secrets Manager using the ephemeral `random_password`, then retrieve it using the ephemeral `aws_secretsmanager_secret_version` resource, and finally write the password to the write-only `password_wo` argument of the `aws_db_instance` resource. | |||
|
|||
### Create a MySQL database in Azure | |||
|
|||
Another example of a using a write-only argument is to create a MySQL database in Azure. In this example, Terraform generates an password using an `ephemeral` resource and passes it to the `administrator_password_wo` write-only argument of the `azurerm_mysql_flexible_server` resource: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another example of a using a write-only argument is to create a MySQL database in Azure. In this example, Terraform generates an password using an `ephemeral` resource and passes it to the `administrator_password_wo` write-only argument of the `azurerm_mysql_flexible_server` resource: | |
You can use a write-only argument to create a MySQL database in Azure. In the following example, Terraform generates an password using an `ephemeral` resource and passes it to the `administrator_password_wo` write-only argument of the `azurerm_mysql_flexible_server` resource: |
If someone just scanned and started reading this example, "Another example . . . " would be jarring. We should avoid assuming that someone is reading the page linearly.
Add Azure examples to write-only arguments!