Skip to content

azurermNginxConfiguration

Manages the configuration for a Nginx Deployment.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
new azurerm.nginxConfiguration.NginxConfiguration(this, "test", {
  config_file: [
    {
      content:
        "${base64encode(<<-EOT\nhttp {\n    server {\n        listen 80;\n        location / {\n            default_type text/html;\n            return 200 '<!doctype html><html lang=\"en\"><head></head><body>\n                <div>this one will be updated</div>\n                <div>at 10:38 am</div>\n            </body></html>';\n        }\n        include site/*.conf;\n    }\n}\nEOT\n    )}",
      virtual_path: "/etc/nginx/nginx.conf",
    },
    {
      content:
        "${base64encode(<<-EOT\nlocation /bbb {\n default_type text/html;\n return 200 '<!doctype html><html lang=\"en\"><head></head><body>\n  <div>this one will be updated</div>\n  <div>at 10:38 am</div>\n </body></html>';\n}\nEOT\n    )}",
      virtual_path: "/etc/nginx/site/b.conf",
    },
  ],
  nginx_deployment_id: "${azurerm_nginx_deployment.test.id}",
  root_file: "/etc/nginx/nginx.conf",
});

Arguments Reference

The following arguments are supported:

  • nginxDeploymentId - (Required) The ID of the Nginx Deployment. Changing this forces a new Nginx Configuration to be created.

  • rootFile - (Required) Specify the root file path of this Nginx Configuration.


-> NOTE: Either packageData or configFile must be specified - but not both.

  • packageData - (Optional) Specify the package data for this configuration.

  • configFile - (Optional) One or more configFile blocks as defined below.

  • protectedFile - (Optional) One or more protectedFile (Protected File) blocks with sensitive information as defined below. If specified configFile must also be specified.


A configFile block supports the following:

  • content - (Required) Specifies the base-64 encoded contents of this config file.

  • virtualPath - (Required) Specify the path of this config file.


A protectedFile (Protected File) block supports the following:

  • content - (Required) Specifies the base-64 encoded contents of this config file (Sensitive).

  • virtualPath - (Required) Specify the path of this config file.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of this Nginx Configuration.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Nginx Configuration.
  • read - (Defaults to 5 minutes) Used when retrieving the Nginx Configuration.
  • update - (Defaults to 10 minutes) Used when updating the Nginx Configuration.
  • delete - (Defaults to 10 minutes) Used when deleting the Nginx Configuration.

Import

Nginxs can be imported using the resourceId, e.g.

terraform import azurerm_nginx_configuration.example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Nginx.NginxPlus/nginxDeployments/dep1/configurations/default