Skip to content
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

[CES-641] Create tasks CosmosDB Container #53

Merged
merged 4 commits into from
Jan 14, 2025

Conversation

kin0992
Copy link
Contributor

@kin0992 kin0992 commented Jan 14, 2025

Create the container to persist the tasks.
Add an environment variable to the Azure Function so that the API can access the container name through an environment variable.

@kin0992 kin0992 requested review from a team as code owners January 14, 2025 15:49
Copy link

changeset-bot bot commented Jan 14, 2025

🦋 Changeset detected

Latest commit: 505a05a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@infra/resources Minor
to-do-api Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

📖 Terraform Plan ('infra/resources/dev') - success

Terraform Plan
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  ~ update in-place

Terraform will perform the following actions:

  # azurerm_cosmosdb_sql_container.tasks will be created
  + resource "azurerm_cosmosdb_sql_container" "tasks" {
      + account_name          = "dx-d-itn-playground-pg-cosno-01"
      + database_name         = "db"
      + id                    = (known after apply)
      + name                  = "tasks"
      + partition_key_kind    = "Hash"
      + partition_key_path    = "/id"
      + partition_key_paths   = (known after apply)
      + partition_key_version = 2
      + resource_group_name   = "dx-d-itn-test-rg-01"
      + throughput            = (known after apply)

      + conflict_resolution_policy (known after apply)

      + indexing_policy (known after apply)
    }

  # module.function_app.azurerm_linux_function_app.this will be updated in-place
  ~ resource "azurerm_linux_function_app" "this" {
      ~ app_settings                                   = {
          + "COSMOSDB_TASKS_CONTAINER_NAME"                   = "tasks"
            # (7 unchanged elements hidden)
        }
        id                                             = "/subscriptions/d7de83e0-0571-40ad-b63a-64c942385eae/resourceGroups/dx-d-itn-test-rg-01/providers/Microsoft.Web/sites/dx-d-itn-playground-be-func-01"
        name                                           = "dx-d-itn-playground-be-func-01"
        tags                                           = {
            "CostCenter"  = "TS700 - ENGINEERING"
            "CreatedBy"   = "Terraform"
            "Environment" = "Dev"
            "Owner"       = "DevEx"
            "Scope"       = "Dynatrace PoC"
        }
        # (31 unchanged attributes hidden)

        # (3 unchanged blocks hidden)
    }

  # module.to_do_api.azurerm_api_management_api_policy.policy will be updated in-place
  ~ resource "azurerm_api_management_api_policy" "policy" {
        id                  = "/subscriptions/d7de83e0-0571-40ad-b63a-64c942385eae/resourceGroups/dx-d-itn-test-rg-01/providers/Microsoft.ApiManagement/service/dx-d-itn-playground-pg-apim-01/apis/to-do-api"
      ~ xml_content         = <<-EOT
          - <policies>
          - 	<inbound>
          - 		<base />
          - 		<set-backend-service backend-id="to-do-api-azure-function" />
          - 		<!-- Append base-path, if defined, before invoking the backend -->
          - 		<choose>
          - 			<when condition="@(System.String.IsNullOrEmpty("api"))"></when>
          - 			<otherwise>
          - 				<rewrite-uri template="@(System.String.Concat("api/", context.Request.Url.Path))" />
          - 			</otherwise>
          - 		</choose>
          - 		<cors>
          - 			<allowed-origins>
          - 				<origin>*</origin>
          - 			</allowed-origins>
          - 			<allowed-methods>
          - 				<method>*</method>
          - 			</allowed-methods>
          - 			<allowed-headers>
          - 				<header>*</header>
          - 			</allowed-headers>
          - 			<expose-headers>
          - 				<header>*</header>
          - 			</expose-headers>
          - 		</cors>
          - 	</inbound>
          - 	<outbound>
          - 		<base />
          - 	</outbound>
          - 	<backend>
          - 		<base />
          - 	</backend>
          - 	<on-error>
          - 		<base />
          - 	</on-error>
          + <policies>
          +   <inbound>
          +     <base />
          +     <set-backend-service backend-id="to-do-api-azure-function" />
          + 
          +      <!-- Append base-path, if defined, before invoking the backend -->
          +     <choose>
          +       <when condition='@(System.String.IsNullOrEmpty("api"))'>
          +       </when>
          +       <otherwise>
          +         <rewrite-uri template='@(System.String.Concat("api/", context.Request.Url.Path))' />
          +       </otherwise>
          +     </choose>
          + 
          +     <cors>
          +       <allowed-origins>
          +           <origin>*</origin>
          +       </allowed-origins>
          +       <allowed-methods>
          +           <method>*</method>
          +       </allowed-methods>
          +       <allowed-headers>
          +           <header>*</header>
          +       </allowed-headers>
          +       <expose-headers>
          +           <header>*</header>
          +       </expose-headers>
          +     </cors>
          +   </inbound>
          +   <outbound>
          +     <base />
          +   </outbound>
          +   <backend>
          +     <base />
          +   </backend>
          +   <on-error>
          +     <base />
          +   </on-error>
            </policies>
        EOT
        # (4 unchanged attributes hidden)
    }

Plan: 1 to add, 2 to change, 0 to destroy.

Warning: Argument is deprecated

  with azurerm_cosmosdb_sql_container.tasks,
  on cosmos.tf line 37, in resource "azurerm_cosmosdb_sql_container" "tasks":
  37:   partition_key_path    = "/id"

`partition_key_path` will be removed in favour of the property
`partition_key_paths` in version 4.0 of the AzureRM Provider.

(and one more similar warning elsewhere)

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.

@kin0992 kin0992 merged commit 60f49c6 into main Jan 14, 2025
5 checks passed
@kin0992 kin0992 deleted the features/create-tasks-container branch January 14, 2025 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants