Pulumi Resource: Difference between revisions
(→URN) |
|||
(21 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=External= | =External= | ||
* https://www.pulumi.com/docs/intro/concepts/resources/ | * https://www.pulumi.com/docs/intro/concepts/resources/ | ||
* https://www.pulumi.com/docs/reference/pkg/python/pulumi/#the-pulumi-python-resource-model-1 | |||
=Internal= | =Internal= | ||
* [[Pulumi_Concepts#Resource|Pulumi Concepts]] | * [[Pulumi_Concepts#Resource|Pulumi Concepts]] | ||
Line 6: | Line 8: | ||
=Overview= | =Overview= | ||
Pulumi understands dependencies between resources and uses the relationship between resources to maximize execution parallelism and ensure correct ordering when a stack is instantiated. | Pulumi understands dependencies between resources and uses the relationship between resources to maximize execution parallelism and ensure correct ordering when a stack is instantiated. | ||
=URN= | |||
<font size=-1> | |||
'urn:pulumi:<stack-name>::<project-name>::<resource-type>::<resource-name>' | |||
</font> | |||
Example: | |||
<font size=-1> | |||
'urn:pulumi:dd.test_env.test_app.test_template::datadog-dashboards::datadog:index/dashboardJson:DashboardJson::Adopted-a8q-hyq-jws' | |||
</font> | |||
Where: | |||
* <code>resource-name</code> is the name of the resource in stack. | |||
The URN of an existing resource can be obtained executing <code>pulumi stack export</code>. | |||
=Type= | |||
The "short form" of the resource type can be obtained with <code>pulumi preview</code>: | |||
<font size=-1> | |||
Previewing update (my-org/my-project/my-stack) | |||
Type Name Plan Info | |||
pulumi:pulumi:Stack my-project-my-stack | |||
└─ <font color=indigo><b>datadog:index:Dashboard</b></font> Test Dashboard | |||
</font> | |||
The short form is the rendering of the <code><package>:<module>:<resource-name></code> pattern. The "long form" that can be used as the type argument of the <code>[[Pulumi_Operations#Import_External_Resources_into_a_Stack|pulumi import]]</code> is generated as <code><package>:<module>/<lowercase-first-char-resource-name>:<uppercase-first-char-resource-name></code>. For example "datadog:index:Dashboard" → "datadog:index/dashboard:Dashboard". | |||
The long form can be obtained executing <code>pulumi stack export</code>. | |||
=Protected Resource= | |||
An infrastructure resource marked protected cannot be deleted in the infrastructure platform backend when the stack it is part of is [[Pulumi_Concepts#Destroying_and_Deleting_a_Stack|destroyed]]. The stack destroy operation <code>[[Pulumi_Operations#destroy|pulumi destroy]]</code> fails: | |||
<font size=-1> | |||
pulumi destroy --non-interactive --yes --stack my-org/my-project/my-stack | |||
[...] | |||
Diagnostics: | |||
datadog:index:DashboardJson (Adopted Dashboard): | |||
error: Preview failed: unable to delete resource "urn:pulumi:dd.test.blue::datadog-dashboards::datadog:index/dashboardJson:DashboardJson::Adopted Dashboard" | |||
as it is currently marked for protection. To unprotect the resource, either remove the `protect` flag from the resource in your Pulumi program and run `pulumi up` or use the command: | |||
`pulumi state unprotect 'urn:pulumi:dd.test.blue::datadog-dashboards::datadog:index/dashboardJson:DashboardJson::Adopted Dashboard'` | |||
</font> | |||
A stack that has protected resources can be destroyed if the [[Pulumi_Operations#--exclude-protected|<code>--exclude-protected</code> option is used]]. | |||
A protected resources can be "unprotected" with <code>[[Pulumi_Operations#Unprotect_Resource_in_Stack_State|stack state unprotect]]</code> command. | |||
=Property= | =Property= | ||
Line 11: | Line 60: | ||
==Input Property== | ==Input Property== | ||
==Output Property== | ==Output Property== | ||
=Organizatorium= | |||
<font color=darkkhaki> | |||
TO PROCESS: | |||
* https://www.pulumi.com/docs/intro/concepts/resources/ | |||
* https://www.pulumi.com/docs/reference/pkg/python/pulumi/#the-pulumi-python-resource-model-1 | |||
Include [[Pulumi_Concepts_Inputs_and_Outputs#Output|Output]] in conversation. | |||
Other attributes like id, etc. | |||
The UI has a Resource Graph. | |||
Resource Types: | |||
* pulumi:pulumi:Stack | |||
* pulumi:pulumi:StackReference | |||
* pulumi:providers:kubernetes | |||
* pulumi:providers:pulumi | |||
* kubernetes:helm.sh/v3:Chart | |||
* kubernetes:core/v1:Service | |||
* kubernetes:core/v1:ConfigMap | |||
* kubernetes:apps/v1:Deployment | |||
</font> |
Latest revision as of 15:52, 14 April 2022
External
- https://www.pulumi.com/docs/intro/concepts/resources/
- https://www.pulumi.com/docs/reference/pkg/python/pulumi/#the-pulumi-python-resource-model-1
Internal
Overview
Pulumi understands dependencies between resources and uses the relationship between resources to maximize execution parallelism and ensure correct ordering when a stack is instantiated.
URN
'urn:pulumi:<stack-name>::<project-name>::<resource-type>::<resource-name>'
Example:
'urn:pulumi:dd.test_env.test_app.test_template::datadog-dashboards::datadog:index/dashboardJson:DashboardJson::Adopted-a8q-hyq-jws'
Where:
resource-name
is the name of the resource in stack.
The URN of an existing resource can be obtained executing pulumi stack export
.
Type
The "short form" of the resource type can be obtained with pulumi preview
:
Previewing update (my-org/my-project/my-stack) Type Name Plan Info pulumi:pulumi:Stack my-project-my-stack └─ datadog:index:Dashboard Test Dashboard
The short form is the rendering of the <package>:<module>:<resource-name>
pattern. The "long form" that can be used as the type argument of the pulumi import
is generated as <package>:<module>/<lowercase-first-char-resource-name>:<uppercase-first-char-resource-name>
. For example "datadog:index:Dashboard" → "datadog:index/dashboard:Dashboard".
The long form can be obtained executing pulumi stack export
.
Protected Resource
An infrastructure resource marked protected cannot be deleted in the infrastructure platform backend when the stack it is part of is destroyed. The stack destroy operation pulumi destroy
fails:
pulumi destroy --non-interactive --yes --stack my-org/my-project/my-stack [...] Diagnostics: datadog:index:DashboardJson (Adopted Dashboard): error: Preview failed: unable to delete resource "urn:pulumi:dd.test.blue::datadog-dashboards::datadog:index/dashboardJson:DashboardJson::Adopted Dashboard" as it is currently marked for protection. To unprotect the resource, either remove the `protect` flag from the resource in your Pulumi program and run `pulumi up` or use the command: `pulumi state unprotect 'urn:pulumi:dd.test.blue::datadog-dashboards::datadog:index/dashboardJson:DashboardJson::Adopted Dashboard'`
A stack that has protected resources can be destroyed if the --exclude-protected
option is used.
A protected resources can be "unprotected" with stack state unprotect
command.
Property
Difference between resource and stack inputs/outputs.
Input Property
Output Property
Organizatorium
TO PROCESS:
- https://www.pulumi.com/docs/intro/concepts/resources/
- https://www.pulumi.com/docs/reference/pkg/python/pulumi/#the-pulumi-python-resource-model-1
Include Output in conversation.
Other attributes like id, etc.
The UI has a Resource Graph.
Resource Types:
- pulumi:pulumi:Stack
- pulumi:pulumi:StackReference
- pulumi:providers:kubernetes
- pulumi:providers:pulumi
- kubernetes:helm.sh/v3:Chart
- kubernetes:core/v1:Service
- kubernetes:core/v1:ConfigMap
- kubernetes:apps/v1:Deployment