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

First draft of "No More Click-Ops" blog post #12259

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thoward
Copy link
Contributor

@thoward thoward commented Jul 11, 2024

Proposed changes

Adds a blog post about undoing Click-Ops using pulumi import... This tracks the video on the same topic.

@thoward thoward added the area/blog Content issues on blog posts. label Jul 11, 2024
@thoward thoward added this to the 0.107 milestone Jul 11, 2024
@pulumi-bot
Copy link
Collaborator

Copy link
Contributor

@aaronkao aaronkao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you


<!--more-->

Imagine this; you, a valiant keyboard warrior, skilled in the dark arts of Python, just joined a new company to do DevOps... and inherited some existing cloud infrastructure. The person before you just clicked around in AWS making things, instead of using infrastructure-as-code to manage it. Ugh... We call that "Click-Ops". Congratulations, you’ve found yourself in a Click-Ops hole.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure semicolon is the correct punctuation mark after "Imagine this"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! It should be a colon.


Imagine this; you, a valiant keyboard warrior, skilled in the dark arts of Python, just joined a new company to do DevOps... and inherited some existing cloud infrastructure. The person before you just clicked around in AWS making things, instead of using infrastructure-as-code to manage it. Ugh... We call that "Click-Ops". Congratulations, you’ve found yourself in a Click-Ops hole.

The biggest problem with Click-Ops is reproducibility. There is no easy way to reliably recreate your environment. Suppose you want to be able to create a staging environment to test some changes, and you also want to be able to recreate the production environment in case of disaster. With Click-Ops that's a serious pain.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might add one sentence that says, "this is the strong suite of IaC because you are able to reliably reproduce infrastructure changes without manual errors" or something like that

python3 account_scraper.py > resources.json
```

This will generate a JSON file with an entry for each resource under your account. However, we only want to import some of those. For this example, we'll assume there is a VPC named `thor` in that list, with associated resources also containing the term `thor` in their name. We can filter that out with a quick `jq` expression:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to show the JSON outputted at all?

Also is it useful to explain the format at all?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree here about showing the JSON output.


Ok, now we've got a file called `resources-filtered.json` in Pulumi-compatible JSON format, describing only the resources we want to import for our particular VPC.

Here's the magic moment! Let’s import that into Pulumi and generate our Pulumi program!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should double click here and explain what is happening. It is importing the existing VPC into the state store and then generating code for it. Now this state piece if important because if you just execute the code, well it will try to create anew.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also agree here. When I was reading this, I was wondering exactly what was happening that was letting Pulumi know to manage existing resources rather than just create new ones since nothing in the IaC code was visibly indicating that an import was happening.


## Pulumi Cloud

The Pulumi Cloud is a fully managed service that helps you adopt Pulumi’s open source SDK with ease. It provides built-in state and secrets management, integrates with source control and CI/CD, and offers a web console and API that make it easier to visualize and manage infrastructure. It is free for individual use, with features available for teams.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice touch to add a CTA here. Thanks

@interurban interurban modified the milestones: 0.107, 0.108 Jul 24, 2024
@mikhailshilkov mikhailshilkov removed this from the 0.108 milestone Aug 22, 2024
@aaronkao aaronkao requested review from toriancrane and removed request for interurban and cnunciato September 5, 2024 19:58
Copy link
Contributor

@toriancrane toriancrane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think it looks good with a few recommendations for changes.


Imagine this; you, a valiant keyboard warrior, skilled in the dark arts of Python, just joined a new company to do DevOps... and inherited some existing cloud infrastructure. The person before you just clicked around in AWS making things, instead of using infrastructure-as-code to manage it. Ugh... We call that "Click-Ops". Congratulations, you’ve found yourself in a Click-Ops hole.

The biggest problem with Click-Ops is reproducibility. There is no easy way to reliably recreate your environment. Suppose you want to be able to create a staging environment to test some changes, and you also want to be able to recreate the production environment in case of disaster. With Click-Ops that's a serious pain.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The biggest problem with Click-Ops is reproducibility. There is no easy way to reliably recreate your environment. Suppose you want to be able to create a staging environment to test some changes, and you also want to be able to recreate the production environment in case of disaster. With Click-Ops that's a serious pain.
The biggest problem with Click-Ops is reproducibility. There is no easy way to reliably recreate your environment. Suppose you want to be able to create a staging environment to test some changes, and you also want to be able to recreate the production environment in case of disaster. With Click-Ops, that's a serious pain.


The first step to undoing a Click-Ops mess is to have a look at what is already there. You can do this via the AWS web-based experience, or if you're in love with the command-line like we are, we can use the AWS CLI.

In this case we're going to assume that there is a existing AWS VPC that we want to bring under management by Pulumi. There are likely more than one, so lets look at a list of VPCs:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In this case we're going to assume that there is a existing AWS VPC that we want to bring under management by Pulumi. There are likely more than one, so lets look at a list of VPCs:
In this case we're going to assume that there is a existing AWS VPC that we want to bring under management by Pulumi. There is likely more than one, so lets look at a list of VPCs:

$ aws ec2 describe-vpcs --output JSON
```

This command shows you all the VPCs under your AWS account, in JSON format. Pulumi will let us describe and manage all of that with code, but creating it all from scratch that would need a lot of typing. Luckily, we can import this existing infrastructure with a single command `pulumi import`, which takes a list of resources in JSON format and outputs a Pulumi program in your preferred programming language.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This command shows you all the VPCs under your AWS account, in JSON format. Pulumi will let us describe and manage all of that with code, but creating it all from scratch that would need a lot of typing. Luckily, we can import this existing infrastructure with a single command `pulumi import`, which takes a list of resources in JSON format and outputs a Pulumi program in your preferred programming language.
This command shows you all the VPCs under your AWS account, in JSON format. Pulumi will let us describe and manage all of that with code, but creating it all from scratch would mean a lot of manual typing. Luckily, we can import this existing infrastructure with a single command `pulumi import`, which takes a list of resources in JSON format and outputs a Pulumi program in your preferred programming language.

python3 account_scraper.py > resources.json
```

This will generate a JSON file with an entry for each resource under your account. However, we only want to import some of those. For this example, we'll assume there is a VPC named `thor` in that list, with associated resources also containing the term `thor` in their name. We can filter that out with a quick `jq` expression:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree here about showing the JSON output.


Ok, now we've got a file called `resources-filtered.json` in Pulumi-compatible JSON format, describing only the resources we want to import for our particular VPC.

Here's the magic moment! Let’s import that into Pulumi and generate our Pulumi program!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also agree here. When I was reading this, I was wondering exactly what was happening that was letting Pulumi know to manage existing resources rather than just create new ones since nothing in the IaC code was visibly indicating that an import was happening.

Copy link
Contributor

@toriancrane toriancrane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments but approving so you can push once your updates are in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/blog Content issues on blog posts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants